macro_rules! register_extra_span_field {
($key:expr) => { ... };
}Expand description
Register a tracing-span field name that downstream crates want preserved on Vector’s internal observability output.
A single registration covers both output channels:
- On metrics, the field is added to the allowlist consulted by
VectorLabelFilter(alongside Vector’s built-incomponent_id,component_type,component_kind,buffer_type), sometrics-tracing-contextno longer drops it before the metrics registry sees it. - On logs/traces emitted via
internal_logs, the field is added to the allowlist consulted bySpanFields(alongside the existingcomponent_*prefix gate), so it is captured onto the log event undervector.<field>.
Example: an embedder that owns a “deployment-version” concept of its own can write
register_extra_span_field!("deployment_version"); once at module scope and any internal
metric or log emitted from inside a span carrying that field will inherit it.
Registrations are collected at link time via the inventory crate, so both read paths
are lock-free. The expansion goes through this crate’s re-exports of inventory,
MetricLabel, and SpanField, so callers do not need
a direct inventory dependency.