Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metrics data cleanup on MeterProvider shutdown #1631

Open
lalitb opened this issue Mar 19, 2024 · 0 comments
Open

Metrics data cleanup on MeterProvider shutdown #1631

lalitb opened this issue Mar 19, 2024 · 0 comments
Labels
A-metrics Area: issues related to metrics bug Something isn't working

Comments

@lalitb
Copy link
Member

lalitb commented Mar 19, 2024

Related Problems?

The MeterProvider shutdown sequence is
SdkMeterProvider ::Shutdown() -> opentelemetry_sdk::metrics::Pipeline::shutdown() -> PeriodicReader::shutdown() -> PushMetricsExporter::shutdown

So on shutdown,

  • the MetricReader will do one last collect-and-export cycle, and then stop, and set the exporter state to shutdown.
  • Any new Meters (and subsequently instruments from these meters) created after shutdown will be Noop.

However, the instruments created before the shutdown process can still record measurements. This applies as well to instruments that are created after the shutdown, if they are derived from meters that were established before the shutdown commenced. This behavior implies that these instruments are not aware of the shutdown state, continuing to consume and potentially increase memory with new measurements. This can be an issue with the long-running application.

Describe the solution you'd like:

The suggested approach would be

  • Stop recording all instruments after shutdown.
  • Cleanup the existing metrics for all the instruments.

Considered Alternatives

No response

Additional Context

No response

@lalitb lalitb added enhancement New feature or request triage:todo Needs to be traiged. labels Mar 19, 2024
@lalitb lalitb changed the title [Feature]: Metric data cleanup on MeterProvider shutdown Mar 19, 2024
@lalitb lalitb changed the title Metric data cleanup on MeterProvider shutdown Metrics data cleanup on MeterProvider shutdown Mar 19, 2024
@cijothomas cijothomas added bug Something isn't working A-metrics Area: issues related to metrics and removed enhancement New feature or request triage:todo Needs to be traiged. labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metrics Area: issues related to metrics bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants