prysm-pulse/monitoring/tracing/errors.go

19 lines
455 B
Go
Raw Permalink Normal View History

// Package tracing includes useful functions for opentracing annotations.
package tracing
2019-09-29 18:48:55 +00:00
import (
"go.opencensus.io/trace"
)
// AnnotateError on span. This should be used any time a particular span experiences an error.
func AnnotateError(span *trace.Span, err error) {
if err == nil {
return
}
2019-09-29 18:48:55 +00:00
span.AddAttributes(trace.BoolAttribute("error", true))
span.SetStatus(trace.Status{
Code: trace.StatusCodeUnknown,
Message: err.Error(),
})
}