-
Notifications
You must be signed in to change notification settings - Fork 888
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
Add a Shutdown() method to *Provider
#1073
Comments
Hi @XSAM - we currently define So a call like |
@anuraaga From what I understand, the And I want to propose a type TracerProvider interface {
Tracer(instrumentationName string, opts ...TracerOption) Tracer
Shutdown(ctx context.Context) error
}
type MeterProvider interface {
Meter(instrumentationName string, opts ...MeterOption) Meter
Shutdown(ctx context.Context) error
}
Since |
@XSAM Ah sorry I misread the spec. Actually we already have it implemented as such in Java for tracing but didn't notice we never added it to the spec. Agree, we should |
Same with ForceFlush IMHO. |
From the triage meeting, we need to ensure that we should or not have in the API. |
My proposal on this: We don't need this in the API package, this is an implementation detail, here are some arguments:
Adding this later is backwards compatible, so for the moment I am encouraging to not have it in the API for the moment. |
Not for Go implementations, if you intend to add a method to a published interface. |
You can always derive a new interface from the old one. It doesn't look very pretty but that's how APIs that have been kept backwards compatible for long tend to look like. Cf. Win32/COM https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist4 |
The same problem is everywhere about any interface (even in Java). But what we assume will be backwards compatible will be the usage of the interface not implementations of the interface. So code that is instrumented with this will continue to work, any implementation (for testing purpose, or production implementation) indeed will have to update. |
Something missed here, @bogdandrutu, wasn't called out explicitly in open-telemetry/opentelemetry-go#1206, but I ran into in the last week myself as an "instrumentation dev," just looking to use the library, and not to implement it. The Resolving that problem today requires that callers eschew The question, then, is whether offering I understand that this issue concerns the specification, and not its realization in Go, but we came here by way of this problem in the Go library. |
@seh you are mentioning a SDK ( |
sorry, pressed |
I think the |
As is often the case with resource cleanup, that also brings up the subject of resource ownership. Does handing a Mitigating that, I can imagine some wrapper/decorator types that swallow such a call to |
The TracerProvider in the SDK can provide a broader API than the one in the SDK (which may be implemented as a derived interface). I think Java did this rather elegantly: The (more or less) private TracerProviderSdk class implements both an TracerSdkManagement interface (which has AddSpanProcessor, etc) and the API's TracerProvider interface which has just GetTracer. |
I agree the Therefore, the Since initial functions like |
What are you trying to achieve?
Add a Shutdown() method to
TracerProvider
andMeterProvider
, which would invoke Shutdown() on all processors.Additional context.
There is no convenient way to let our users shut the processors down if their programs want to exit. It is the users' response to keep
Shutdown
functions from processors. Telemetry API should handle this common scenario, which every program does, to make sure spans/metrics are written before exit.Related open-telemetry/opentelemetry-go#1206
The text was updated successfully, but these errors were encountered: