Make sure the GRPC client interceptor actually returns the response #2928
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?
Datadog::Tracing::Contrib::GRPC::DatadogInterceptor::Client#trace is currently causing all GRPC client operations to return 0.0 instead of whatever they were supposed to return. This is a bit of a Ruby gotcha.
This method returns :three
So when
#trace
is puttingyield
in abegin
block with anelse
, it's not actually returning the result of yield; it's returning the result of the else block. I guess this was broken in #2620Fix it by explicitly returning the result of yield.
Motivation
All my GRPC client methods started returning
0.0
after upgrading ddtrace 😱Additional Notes
How to test the change?
Now my GRPC client methods don't return 0.0! I included a test in this patch.