-
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: Fix adding errors to spans and traces #396
Conversation
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.
Great! Thanks a lot for this. Left one comment.
} | ||
sid := span.SpanID() |
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.
Forgotten? :)
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.
Thx, forgotten from debugging :)
@@ -335,6 +339,50 @@ func TestPreservesMetadata(t *testing.T) { | |||
"existing metadata should be preserved") | |||
} | |||
|
|||
func TestStreamSendsErrorCode(t *testing.T) { |
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.
👍 great! Thanks for adding a test.
- Put finishWithError calls inside clojure functions because the deferred function's arguments are evaluated when the defer statement is evaluated. More at https://golang.org/doc/effective_go.html#defer Before this commit, `finishWithError` deferred with nil error and any other changes of the initial value were not added to span. This bug affects only grpc streaming. - Clean tagCode in case that error was disregarded. - Add tests for checking if span contains error.
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.
Thanks!
Updated and ready for review again. |
…DataDog#396) - Put finishWithError calls inside clojure functions because the deferred function's arguments are evaluated when the defer statement is evaluated. More at https://golang.org/doc/effective_go.html#defer Before this commit, `finishWithError` deferred with nil error and any other changes of the initial value were not added to span. This bug affects only grpc streaming. - Clean tagCode in case that error was disregarded. - Add tests for checking if span contains error.
finishWithError
calls inside closure functions because the deferredfunction's arguments are evaluated when the defer statement is
evaluated. More at https://golang.org/doc/effective_go.html#defer
Before this commit,
finishWithError
deferred with nil error (initial value)and any other changes of the initial value were not added to span. This bug
affects only grpc streaming.
tagCode
in case of disregarded error.