Skip to content

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

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

fix(security): inherit component_type on confinement gauge from ambient span#25919
vladimir-dd wants to merge 3 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.

Vector configuration

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

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>
…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>
@vladimir-dd
vladimir-dd marked this pull request as ready for review July 23, 2026 18:27
@vladimir-dd
vladimir-dd requested a review from a team as a code owner July 23, 2026 18:27
@vladimir-dd vladimir-dd changed the title fix(security): inherit component_type on confinement gauge from ambient span chore(security): inherit component_type on confinement gauge from ambient span Jul 23, 2026
@vladimir-dd vladimir-dd changed the title chore(security): inherit component_type on confinement gauge from ambient span fix(security): inherit component_type on confinement gauge from ambient span Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

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 ConfinementConfig::set_confinement_gauge entirely and moves gauge ownership to the topology (RunningTopology::refresh_confinement_gauges), which tags the gauge from the topology's own knowledge of each top-level sink's declared component_type via a new SinkConfig::confinement_config() opt-in method — rather than from the ambient tracing span as this PR does. That structurally eliminates the class of bug this PR fixes (a delegate sink's build() can no longer report its own type in place of the wrapping sink's, since the gauge is never emitted from inside build() at all anymore), and it additionally fixes gauge expiry, which this PR didn't address.

No further action needed here — #25910 already covers this with its own test suite in src/topology/test/confinement_gauge.rs.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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