You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 23, 2023. It is now read-only.
It's very useful to know when a Span has failed and to capture the error. However, with the current mechanism, log.Error, one ends up with code that looks like this:
span, ctx := opentracing.StartSpanFromContext(ctx, "operationName")
defer span.Finish()
if err := boom(); err != nil {
err := errors.Wrapf(err, "unable to do %v to %v", x, y)
ext.Error.Set(span, true)
return nil, err
}
Instead, have you considered adding Error/Errorf or Wrap/Wrapf funcs to span similar to Dave Cheney's error package? The previous code could be reduced to:
span, ctx := opentracing.StartSpanFromContext(ctx, "operationName")
defer span.Finish()
if err := boom(); err != nil {
return nil, span.Errorf(err, "unable to do %v to %v", x, y)
}