Skip to content

fix(security): inherit component_type on confinement gauge from ambient span#25919

Draft
vladimir-dd wants to merge 2 commits into
masterfrom
fix/humio-logs-confinement-gauge-component-name
Draft

fix(security): inherit component_type on confinement gauge from ambient span#25919
vladimir-dd wants to merge 2 commits into
masterfrom
fix/humio-logs-confinement-gauge-component-name

Conversation

@vladimir-dd

@vladimir-dd vladimir-dd commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

ConfinementConfig::set_confinement_gauge explicitly hardcoded component_type/component_kind labels from the calling sink's own Self::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) inherits component_type from the ambient tracing span the topology builder opens around the whole SinkConfig::build call (component_type = %sink.inner.get_component_name() in src/topology/builder.rs).

That's harmless when a sink is built directly, since Self::NAME matches the ambient span's type anyway. But it breaks when:

  • One sink delegates its build to another SinkConfig::build internally (e.g. humio_metricshumio_logs), or
  • An external/downstream sink constructs a Vector sink config and calls .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_type parameters from set_confinement_gauge entirely 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.

An earlier version of this fix instead widened HumioLogsConfig::build_without_confinement_gauge's visibility so external wrappers could pass their own component name explicitly — that would have worked for this one case but wouldn't have fixed the general inconsistency (any future delegating/wrapping sink would hit the same bug), so this PR fixes the actual root cause instead.

Vector configuration

N/A — this only changes internal metric tagging, not sink behavior or configuration surface.

How did you test this PR?

  • cargo check -p vector --lib --no-default-features --features sinks — clean, no errors/warnings.
  • cargo clippy -p vector --lib --no-default-features --features sinks --no-deps — clean.
  • cargo test -p vector --lib --no-default-features --features sinks template:: — 42 passed, 0 failed.
  • cargo fmt

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Changelog fragment added at changelog.d/confinement_gauge_component_type_override.fix.md.
  • No.

References

…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>
@github-actions github-actions Bot added the domain: sinks Anything related to the Vector's sinks label Jul 22, 2026
… 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: sinks Anything related to the Vector's sinks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant