fix(security): inherit component_type on confinement gauge from ambient span#25919
fix(security): inherit component_type on confinement gauge from ambient span#25919vladimir-dd wants to merge 3 commits into
Conversation
…nt span ConfinementConfig::set_confinement_gauge explicitly hardcoded component_type/component_kind labels from the calling sink's own Self::NAME, unlike every other per-component metric (e.g. component_sent_events_total), which inherits component_type from the ambient tracing span the topology builder opens around the whole SinkConfig::build call. This mismatch is harmless for a sink built directly, but breaks when one sink delegates its build to another SinkConfig::build internally (e.g. humio_metrics -> humio_logs), or when an external sink constructs and builds a Vector sink directly (e.g. Datadog's observability-pipelines-worker crowdstrike_next_gen_siem sink delegating to humio_logs, see DataDog/observability-pipelines-worker#2652) -- the gauge reports the delegate's own component type instead of the wrapping sink's, while every other metric on the same build correctly reports the wrapping sink's type. Drop the explicit labels and let the gauge inherit from the ambient span like everything else, so delegating/wrapping sinks report the correct component_type with no extra plumbing. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… inheritance Adds a unit test for the fix in 8eac9b0 that verifies the security_confinement_disabled gauge inherits component_type from the ambient tracing span (e.g. a wrapping external sink) rather than hardcoding the delegated sink's own type. Verified this test fails against the pre-fix behavior and passes against the fix. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ment Removes a reference to an internal downstream consumer from the regression test comment and generalizes the example component_type used, since this repo is public and the comment shouldn't name internal-only code. Environment: Datadog workspace Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Closing as superseded by #25910, which merged into master after this branch was cut. #25910 does a more complete rewrite of the same subsystem: it removes No further action needed here — #25910 already covers this with its own test suite in |
Summary
ConfinementConfig::set_confinement_gaugeexplicitly hardcodedcomponent_type/component_kindlabels from the calling sink's ownSelf::NAME. This is the only per-component metric in Vector that does this — every other one (e.g.component_sent_events_total,http_client_requests_sent_total) inheritscomponent_typefrom the ambient tracing span the topology builder opens around the wholeSinkConfig::buildcall (component_type = %sink.inner.get_component_name()insrc/topology/builder.rs).That's harmless when a sink is built directly, since
Self::NAMEmatches the ambient span's type anyway. But it breaks when:SinkConfig::buildinternally (e.g.humio_metrics→humio_logs), or.build()on it directly to wrap it.In both cases the gauge reports the delegate's own component type instead of the wrapping sink's — while every other metric on that same build correctly reports the wrapping sink's type, because they don't override the ambient span.
Fix
Drop the explicit
component_kind/component_typeparameters fromset_confinement_gaugeentirely and let it inherit from the ambient span like every other metric. Updated all 27 call sites across the sink modules accordingly. No behavior change for sinks built directly; delegating/wrapping sinks now report the correct component type with no extra plumbing.Vector configuration
N/A — this only changes internal metric tagging, not sink behavior or configuration surface.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
changelog.d/confinement_gauge_component_type_override.fix.md.References