Flushing Global Meter Provider #3024
Replies: 1 comment
-
You need to store the SdkMeterProvider and call flush/shutdown on it. (A clone of it can be set as the global_one) The examples should already be showing this approach: We expect to tweak the wording here to make this more clear: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using otel metrics, specifically opentelemetry::global. I am using global::set_meter_provider on startup to initialize my metrics, and then creating new meter providers via global::meter.
I would like to be able to flush my meter provider, specifically as a part of cleanup in my application's panic hook. I can see that SdkMeterProvider has a force_flush method. However, global::meter_provider returns a dyn MeterProvider, which from what I can tell does not have a flush method. In this scenario, is there a recommended way for the meter provider to be flushed before shutdown? Or will I need to manually store my initial SdkMeterProvider that I use for global::set_meter_provider for shutdown?
Beta Was this translation helpful? Give feedback.
All reactions