MCPcopy
hub / github.com/grpc/grpc-go / stopOpenCensus

Function stopOpenCensus

gcp/observability/opencensus.go:162–179  ·  view source on GitHub ↗

stopOpenCensus flushes the exporter's and cleans up globals across all packages if exporter was created.

()

Source from the content-addressed store, hash-verified

160// stopOpenCensus flushes the exporter's and cleans up globals across all
161// packages if exporter was created.
162func stopOpenCensus() {
163 if exporter != nil {
164 internal.ClearGlobalDialOptions()
165 internal.ClearGlobalServerOptions()
166 // This Unregister call guarantees the data recorded gets sent to
167 // exporter, synchronising the view package and exporter. Doesn't matter
168 // if views not registered, will be a noop if not registered.
169 view.Unregister(defaultViews...)
170 // Call these unconditionally, doesn't matter if not registered, will be
171 // a noop if not registered.
172 trace.UnregisterExporter(exporter)
173 view.UnregisterExporter(exporter)
174
175 // This Flush call makes sure recorded telemetry get sent to backend.
176 exporter.Flush()
177 exporter.Close()
178 }
179}

Callers 1

EndFunction · 0.85

Calls 2

FlushMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected