-
Notifications
You must be signed in to change notification settings - Fork 893
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
PeriodicExportingMetricReader should collect all metrics on shutdown #2983
Comments
just to clarify, in Java this functionality is part of the autoconfiguration layer (which is a separate artifact from the SDK itself): |
@trask it looks like that code triggers the SDK to shut down when the process is ending, which is a separate important issue. This issue is about what the shutdown behavior is; the spec doesn't require |
The tracing spec has added something similar https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#shutdown-1.
|
Python and Java implementations do indeed force flush on shutdown, but Node does not (even though this comment indicates that it does, it doesn't). This could be a source of confusion for users, and maybe worth specifying? |
Currently, the OTEL Metrics SDK spec documents https://opentelemetry.io/docs/specs/otel/metrics/sdk/#shutdown Are you proposing that Or that on |
Tracing and logs shutdown includes flush in the specification. @open-telemetry/technical-committee should metric shutdown also include flush? |
I don't see any reason not to. Java and python have been doing this for years without issue. It doesn't appear that anyone has any arguments on why we shouldn't do this. If no one makes such an argument, let's update the spec. |
@jsuereth has agreed to sponsor this. |
Hi all, going back to this question:
My assumption is that the agreement here is that the Some links to other implementations that seem to confirm my assumption:
|
What are you trying to achieve?
Capture metrics which may be abnormal around the time my service stops. When my application exits or I otherwise call
MeterProvider.shutdown()
, I want to do a final collection of metrics for all push based exporters. I would potentially also expectMeterProvider.forceFlush()
to do the same thing.What did you expect to see?
Calling
MeterProvider.shutdown()
should cause any registeredPeriodicExportingMetricReader
to do a final collection and send the data out through the push exporters. Right now this behavior is not specified as far as I can tell.Additional context.
The Python SDK does this already and I believe Java does as well (cc @jsuereth). However, JS SDK doesn't do this right now open-telemetry/opentelemetry-js#3278 and you have to manually call
reader.collect()
.The text was updated successfully, but these errors were encountered: