opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

No way to reset meter state

Open lionskape opened this issue 5 months ago • 0 comments
trafficstars

NB: Before opening a feature request against this repo, consider whether the feature should/could be implemented in the other OpenTelemetry client libraries. If so, please open an issue on opentelemetry-specification first.

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

I'm writing a tests for my code and using InMemoryMetricExporter exporter to validate measured metrics and values. So, I have no way to reset an internal state of metrics shared state. Calling reset on exporter only reset a state of exporter, but not the collected values from internal state (shared state)

Describe the solution you'd like

Something like a method of MeterProvider to reset an internal state

Additional context

It's absolutely mandatory to validate if metrics are recorded correctly for any big project. So, in-memory experts is a great option for that, but there is definitely a lack of some mandatory features for that. So, also please note, that "just replace a MeterProvider is not an option". Testing code can store a provider instide itself, during the runs.

lionskape avatar Jun 01 '25 22:06 lionskape