-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Verify compliant metric SDK specification implementation: MeterProvider/Shutdown #3643
Comments
This is a normative statement for the user of a Our implementation does handle the case where a user calls shutdown multiple times by using a opentelemetry-go/sdk/metric/config.go Line 77 in b2246d5
|
The opentelemetry-go/sdk/metric/provider.go Lines 66 to 67 in b2246d5
However, our implementation is not compliant: func TestMeterAfterShutdownIsNoOp(t *testing.T) {
mp := NewMeterProvider()
require.NoError(t, mp.Shutdown(context.Background()))
m := mp.Meter("TestMeterAfterShutdownIsNoOp")
_, ok := m.(noop.Meter)
assert.Truef(t, ok, "Meter from shutdown MeterProvider is not NoOp: %T", m)
} $ go test ./...
provider_test.go:86:
Error Trace: /home/tyler/go/src/go.opentelemetry.io/otel/sdk/metric/provider_test.go:86
Error: Should be true
Test: TestMeterAfterShutdownIsNoOp
Mejssages: Meter from shutdown MeterProvider is not NoOp: *metric.meter |
An error is returned from the method: opentelemetry-go/sdk/metric/provider.go Line 113 in b2246d5
|
The method is documented to comply with this recommendation: opentelemetry-go/sdk/metric/provider.go Lines 107 to 110 in b2246d5
The behavior though is going to depend on the Readers and exporters as this context is passed on to them and the cancel logic is expected to be applied there. The manual reader seems to comply as it doesn't have any blocking operations (it has nowhere to flush a final collection so it just shuts down): opentelemetry-go/sdk/metric/manual_reader.go Lines 97 to 113 in b2246d5
The periodic reader does a final collection and then shuts down the exporter. Each of these operations pass the context: opentelemetry-go/sdk/metric/periodic_reader.go Lines 322 to 324 in b2246d5
The exporter behavior is out of scope for the The collection is going to call the pipeline produce. That handles the context timeouts according to the specification: It will also call the external metric producers (bridges):
These are out of scope of the |
opentelemetry-go/sdk/metric/provider.go Lines 97 to 118 in b2246d5
|
Timeouts are handled via context timeouts. opentelemetry-go/sdk/metric/provider.go Lines 107 to 110 in b2246d5
|
Indeed it is: opentelemetry-go/sdk/metric/config.go Lines 25 to 83 in b2246d5
|
Outstanding issues: |
@MrAlias I think that this issue can be resolved. |
The text was updated successfully, but these errors were encountered: