Skip to content

fix(topology): prevent security_confinement_disabled gauge from expiring#25910

Merged
thomasqueirozb merged 2 commits into
masterfrom
fix/confinement-gauge-expiry
Jul 23, 2026
Merged

fix(topology): prevent security_confinement_disabled gauge from expiring#25910
thomasqueirozb merged 2 commits into
masterfrom
fix/confinement-gauge-expiry

Conversation

@thomasqueirozb

@thomasqueirozb thomasqueirozb commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

The vector_security_confinement_disabled gauge was emitted once per sink at build time and its handle dropped immediately, so the metric aged out of the registry after the idle timeout (300s by default) while the sink was still running with confinement disabled. Ownership of the gauge is moved to the topology, which holds a handle for each confinement-aware sink's lifetime and reconciles the gauges on every (re)load.

Without this fix, any dashboard or alert watching vector_security_confinement_disabled silently loses signal ~5 minutes after startup, making it impossible to detect sinks running with confinement disabled for the rest of their lifetime. An absent gauge was also indistinguishable from a sink that had been removed or renamed.

Vector configuration

sources:
  dummy:
    type: demo_logs
    format: json
    interval: 30

  internal:
    type: internal_metrics
    scrape_interval_secs: 15

transforms:
  only_confinement:
    type: filter
    inputs: [internal]
    condition: .name == "security_confinement_disabled"

sinks:
  confinement_sink:
    type: file
    inputs: [dummy]
    path: /tmp/vector-confinement-test.log
    encoding:
      codec: text

  watch:
    type: console
    inputs: [only_confinement]
    encoding:
      codec: json

How did you test this PR?

Before it stopped outputting to the console after 300s (20 logs) and now it continues.

make check-clippy, make check-fmt, and make check-changelog-fragments all pass. Added src/topology/test/confinement_gauge.rs covering per-sink series at startup, absence for non-confinement sinks, and value updates on reload; the topology test suite passes (cargo nextest run --lib topology::test::).

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. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

NA

@github-actions github-actions Bot added domain: topology Anything related to Vector's topology code domain: sinks Anything related to the Vector's sinks labels Jul 20, 2026
@thomasqueirozb

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 6db1b56057

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@thomasqueirozb
thomasqueirozb marked this pull request as ready for review July 21, 2026 16:09
@thomasqueirozb
thomasqueirozb requested a review from a team as a code owner July 21, 2026 16:09
@thomasqueirozb thomasqueirozb added the domain: metrics Anything related to Vector's metrics events label Jul 22, 2026

@pront pront left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix. I am not a fan of the changes in src/topology/running.rs but that is a pre-existing issue. We can address this in a follow-up. Approving to fix this bug.

Note: I also suspect this fixes another bug where in some cases the tags point to the wrong component id.

Comment thread src/test_util/mock/sinks/basic.rs Outdated
Comment thread src/topology/test/confinement_gauge.rs
@thomasqueirozb
thomasqueirozb enabled auto-merge July 23, 2026 14:40
@thomasqueirozb
thomasqueirozb added this pull request to the merge queue Jul 23, 2026
Merged via the queue into master with commit e5e6eeb Jul 23, 2026
61 checks passed
@thomasqueirozb
thomasqueirozb deleted the fix/confinement-gauge-expiry branch July 23, 2026 15:29
@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: metrics Anything related to Vector's metrics events domain: sinks Anything related to the Vector's sinks domain: topology Anything related to Vector's topology code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants