mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-03 00:38:40 +08:00
fix: StopAgent panics when trace agent disabled (#3981)
Co-authored-by: ansoda <ansoda@gmail.com>
This commit is contained in:
parent
d184f96b13
commit
69bb746a1d
@ -59,7 +59,13 @@ func StartAgent(c Config) {
|
|||||||
|
|
||||||
// StopAgent shuts down the span processors in the order they were registered.
|
// StopAgent shuts down the span processors in the order they were registered.
|
||||||
func StopAgent() {
|
func StopAgent() {
|
||||||
|
lock.Lock()
|
||||||
|
defer lock.Unlock()
|
||||||
|
|
||||||
|
if tp != nil {
|
||||||
_ = tp.Shutdown(context.Background())
|
_ = tp.Shutdown(context.Background())
|
||||||
|
tp = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createExporter(c Config) (sdktrace.SpanExporter, error) {
|
func createExporter(c Config) (sdktrace.SpanExporter, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user