-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal for a Span#Error
#248
Comments
How about an internal func handleError(span trace.Span, err error) error {
span.SetStatus(codes.Internal)
span.SetAttribute(key.String("error", err.Error()))
return err
} Then, we're not setting up a new public method for error handling, and you can still reduce code repetition. |
That is certainly a solution, but perhaps this is a pattern that will repeat for pretty much all other Go projects ? |
Another solution is the discussion in #174. |
I understand #174 to be a way for my application to be called back when there's an error in an internal OpenTelemetry component. This issue here is about adding "error" attributes to an active span. |
(Yes, #174 is unrelated.) This issue points out a flaw in the current implementation of Go 1.13 has some new error handling support, see https://blog.golang.org/go1.13-errors I would consider a proposal that simplified your code to:
What I'd really prefer is:
|
If
(the name |
I could also agree that |
open-telemetry/opentelemetry-specification#427 covers this |
Resolved at spec meeting: we're okay to proceed for 0.3 but may need to change it for 0.4 |
* Bump cloud.google.com/go from 0.63.0 to 0.64.0 in /detectors/gcp Bumps [cloud.google.com/go](https://github.com/googleapis/google-cloud-go) from 0.63.0 to 0.64.0. - [Release notes](https://github.com/googleapis/google-cloud-go/releases) - [Changelog](https://github.com/googleapis/google-cloud-go/blob/master/CHANGES.md) - [Commits](googleapis/google-cloud-go@v0.63.0...v0.64.0) Signed-off-by: dependabot[bot] <support@github.com> * Auto-fix go.sum changes in dependent modules Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
When instrumenting the Jaeger Operator, I find myself repeating calls like this:
Perhaps it's a sign that the API could have a
span.Error()
function, so that it can be called as follows:This new function could accept an array of
ErrorOptions
, allowing callers to override the error code and possibly the attribute name.The text was updated successfully, but these errors were encountered: