-
Notifications
You must be signed in to change notification settings - Fork 576
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
why otelhttptrace duplicate? #5562
Comments
Both are not required, but they are there for the sake of the example (we could possibly document that only one is required). The otelhttp transport will override the client trace from the context in case one is set: opentelemetry-go-contrib/instrumentation/net/http/otelhttp/transport.go Lines 136 to 138 in 8cb2ad6
So setting in the client allows making sure there's one set for every HTTP request that client makes. Setting it in the context is the official recommended way from the httptrace example: https://pkg.go.dev/net/http/httptrace |
@zdyj3170101136 When no modifications are made, it appears that spans are being recorded twice the original count. This happens because two calls to Here's the output after removing the registered
|
Ah yes, WithClientTrace appends new tracers, it does not replace. This probably warrants a documentation change, but the only real fix here is to only use one of the two config methods, not both. |
Thanks for your reply. Maybe we can get do |
@dmathieu Sorry, my bad. Thanks again for your getting back. |
Closing, as this issue seems to be resolved. |
) Closes #5562 --------- Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
in example:
https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/net/http/httptrace/otelhttptrace/example/client/client.go
why func otelhttptrace.NewClientTrace have called twice?
which is correct?
The text was updated successfully, but these errors were encountered: