-
Notifications
You must be signed in to change notification settings - Fork 626
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
ext/jaeger: fix exporting to collector #508
ext/jaeger: fix exporting to collector #508
Conversation
The exporting of traces to the collector is broken, it replies with the "Unable to process request body: Required field Process is not set" error. The current implementation is based on OpenCensus [1], what appears to be broken too, it's not totally clear at this time what's wrong with that. This commit changes the exporting logic to be similar to the opentelemetry-go [2] one that is working. The main change is to perform the request directly without using the client provided by the generated files. [1] https://github.com/census-instrumentation/opencensus-python/tree/master/contrib/opencensus-ext-jaeger [2] https://github.com/open-telemetry/opentelemetry-go/blob/master/exporters/trace/jaeger/jaeger.go
transport = TTransport.TMemoryBuffer() | ||
protocol = TBinaryProtocol.TBinaryProtocol(transport) | ||
batch.write(protocol) | ||
body = transport.getvalue() |
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.
Is it not possible to stream this to requests.post? With this, we have to hold the whole serialized blob in memory at once.
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.
Good point. I studied the problem a little bit more and realized it is possible to directly use thrift.transport.THttpClient
as transport of the TBinaryProtocol
object, it means that the writes will be done directly in the buffer used to stream data avoiding this intermediate storage, it also avoid to have requests as a dependency here.
The exporting of traces to the collector is broken, it replies with the "Unable to process request body: Required field Process is not set" error. The current implementation is based on OpenCensus [1], what appears to be broken too, it's not totally clear at this time what's wrong with that. This commit changes the logic to avoid using jaeger.Client that appears to be the broken piece, it is changed by a direct invokation to the THTTPClient transport from thrift.
Codecov Report
@@ Coverage Diff @@
## master #508 +/- ##
==========================================
+ Coverage 89.48% 89.56% +0.08%
==========================================
Files 43 43
Lines 2215 2213 -2
Branches 250 249 -1
==========================================
Hits 1982 1982
+ Misses 161 159 -2
Partials 72 72
Continue to review full report at Codecov.
|
Nice! Can you elaborate further on what the fix was? I'm not clear why submitBatches didn't work, but the batch.write did. |
Neither am I. The implementation of Once I had a working version I stopped looking for the root reason of the problem. [1] Lines 42 to 48 in fbfafa4
|
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 for the catch!
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 for the fix @mauriciovasquezbernal, LGTM!
* ci: install minimal lint & doc deps * fix: lint
Edit: I updated the PR to use THTTPClient directly
Fixes #493.
How to test:
Run the Jaeger collector, I used (notice there is not any port for the agent)
Export some traces to the collector:
Check that those traces where exported to Jaeger in http://localhost:16686.