-
Notifications
You must be signed in to change notification settings - Fork 436
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
contrib/google.golang.org/grpc: add error details to span tags #2228
contrib/google.golang.org/grpc: add error details to span tags #2228
Conversation
0a05dc4
to
af51fc3
Compare
if e, ok := status.FromError(err); ok && cfg.withErrorDetailTags { | ||
for i, d := range e.Details() { | ||
if d, ok := d.(proto.Message); ok { | ||
span.SetTag(tagStatusDetailsPrefix+fmt.Sprintf("_%d", i), d.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that apm treats them as arrays if they are consecutive numeric strings, otherwise it treats them as objects.
In other words, if the index(i) is off, the array might become an object.
Therefore, I changed the key to a string like "_0" and treated it as an object.
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What does this PR do?
If grpc error return value contains details, add it to the span tags
Users can enable this with the WithErrorDetailTags option
Fixes #1993
Motivation
See #1993.
Reviewer's Checklist
For Datadog employees:
@DataDog/security-design-and-guidance
.Unsure? Have a question? Request a review!