Skip to content

Find a better home for metrics tied to components' lifecycle #25932

Description

@thomasqueirozb

PR #25910 fixed vector_security_confinement_disabled expiring by storing Gauge handles in RunningTopology::sink_confinement_gauges. It works, but it's a band-aid:

  • RunningTopology now has to know about a specific metric's lifecycle, which is the wrong layer of abstraction.
  • Any future one-shot build-time gauge would need the same treatment. Another field in RunningTopology and another ad-hock hook inside topology code.

The right fix is a general mechanism where a component can register a metric handle that is tied to its lifetime, without the topology needing to know what the handle is. Options worth exploring:

  • A handle bag in SinkContext (or a shared ComponentContext) that the topology drains and holds per component key.
  • A trait-level hook (e.g. fn static_metric_handles(&self) -> Vec<Box<dyn Any>>) so the topology can hold arbitrary handles opaquely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: tech debtA code change that does not add user value.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions