contrib/google.golang.org/grpc: add error details to span tags#2228
Merged
zarirhamza merged 9 commits intoDec 22, 2023
Conversation
eyasy1217
marked this pull request as ready for review
September 22, 2023 01:41
eyasy1217
marked this pull request as draft
September 22, 2023 03:31
eyasy1217
force-pushed
the
add-error-details-to-span-tag
branch
from
September 22, 2023 04:39
0a05dc4 to
af51fc3
Compare
eyasy1217
commented
Sep 22, 2023
| 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()) |
Contributor
Author
There was a problem hiding this comment.
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.
eyasy1217
marked this pull request as ready for review
September 22, 2023 04:44
Contributor
|
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. |
Contributor
|
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. |
zarirhamza
enabled auto-merge (squash)
December 20, 2023 15:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!