Skip to content

[api] Implement a delegating no-op MeterProvider #3622

@pichlermarc

Description

@pichlermarc

Is your feature request related to a problem? Please describe.

Currently when a MeterProvider is registered via metrics.setMeterProvider() after acquiring a metrics.getMeterProivder() elsewhere, the previously acquired MeterProvider will stay no-op forever unless replaced manually. This causes instrumentations that are registered before the creation of an SDK MeterProvider to never provide any metrics.

Describe the solution you'd like

Implementing the same delegating-noop similar to the one in the trace API, where a ProxyTracerProvider and ProxyTracer delegate calls to either the registered SDK instance or a NoopTracerProvider or NoopTracer.

Describe alternatives you've considered

  • providing a hook in the API for instrumentations to update their MeterProvider, Meter, or Instrument instances, once a new MeterProvider is registered. However, this may require significant implementation overhead for anyone who wants to take care of such a case.

Additional context

Related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions