we can use otel.ErrorHandlerFunc instead of custom struct when we update OpenTelemetry to 1.0.0 (#1081)

master
neosu 3 years ago committed by GitHub
parent c74fb988e0
commit 2695c30886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -52,17 +52,10 @@ func StartAgent(c Config) {
otel.SetTracerProvider(tp)
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
otel.SetErrorHandler(otelErrHandler{})
otel.SetErrorHandler(otel.ErrorHandlerFunc(func(e error) {
logx.Errorf("[otel] error: %v", err)
}))
enabled.Set(true)
})
}
// errHandler handing otel errors.
type otelErrHandler struct{}
var _ otel.ErrorHandler = otelErrHandler{}
func (o otelErrHandler) Handle(err error) {
logx.Errorf("[otel] error: %v", err)
}

Loading…
Cancel
Save