1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

Flush metric events before shutdown in collector example (#1438)

Fixes #1437
This commit is contained in:
Tyler Yahn
2021-01-06 10:50:58 -08:00
committed by GitHub
parent f6f458e155
commit db06c8d1cb
+5 -2
View File
@@ -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
}
}