Skip to content

Allow to unregister/stop/destroy instruments #2232

@mateuszrzeszutek

Description

@mateuszrzeszutek

What are you trying to achieve?

I'm currently working on the micrometer->OTel bridge instrumentation in the javaagent. Micrometer offers the possibility to remove a meter from the MeterRegistry and stop emitting whatever metrics it used to collect. For example, suppose you use a database connection pool that's instrumented with metrics - when you close/destroy the whole pool you probably want to stop collecting any metrics associated to it (because it doesn't exist anymore). This is useful for both asynchronous instruments (since once they're registered there's no way to stop them) and synchronous instruments (you can just stop using them, but the metrics SDK will still send in the last recorded value).

Additional context.

Micrometer bridge PR: open-telemetry/opentelemetry-java-instrumentation#4919

CC @jsuereth

Metadata

Metadata

Assignees

No one assigned

    Labels

    spec:metricsRelated to the specification/metrics directorytriage:accepted:ready-with-sponsorReady to be implemented and has a specification sponsor assigned

    Type

    No type

    Projects

    Status

    Spec - Accepted

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions