mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-20 03:30:02 +02:00
Flush metric events before shutdown in collector example (#1438)
Fixes #1437
This commit is contained in:
parent
f6f458e155
commit
db06c8d1cb
@ -88,9 +88,12 @@ func initProvider() func() {
|
||||
pusher.Start()
|
||||
|
||||
return func() {
|
||||
handleErr(tracerProvider.Shutdown(ctx), "failed to shutdown provider")
|
||||
// Shutdown will flush any remaining spans.
|
||||
handleErr(tracerProvider.Shutdown(ctx), "failed to shutdown TracerProvider")
|
||||
|
||||
// Push any last metric events to the exporter.
|
||||
pusher.Stop()
|
||||
handleErr(exp.Shutdown(ctx), "failed to stop exporter")
|
||||
pusher.Stop() // pushes any last exports to the receiver
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user