opentelemetry-go-contrib
                                
                                 opentelemetry-go-contrib copied to clipboard
                                
                                    opentelemetry-go-contrib copied to clipboard
                            
                            
                            
                        [otelhttp] transport metrics
Add HTTP client metrics following the semantic conventions.
As users of Transport are not expected to have a handler where they can customize the attributes using a Labeler, callback function options were added to add attributes from the request and the reponse objects.
Fixes #3134 Fixes #1336
Codecov Report
Merging #3769 (45ceb1d) into main (7d9626d) will increase coverage by
0.0%. Report is 1 commits behind head on main. The diff coverage is94.4%.
:exclamation: Current head 45ceb1d differs from pull request most recent head e28520c. Consider uploading reports for the commit e28520c to get more accurate results
Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3769   +/-   ##
=====================================
  Coverage   79.4%   79.4%           
=====================================
  Files        166     166           
  Lines      10360   10401   +41     
=====================================
+ Hits        8230    8266   +36     
- Misses      1996    1999    +3     
- Partials     134     136    +2     
| Files Changed | Coverage Δ | |
|---|---|---|
| instrumentation/net/http/otelhttp/common.go | 100.0% <ø> (ø) | |
| instrumentation/net/http/otelhttp/transport.go | 94.1% <93.4%> (-0.7%) | :arrow_down: | 
| instrumentation/net/http/otelhttp/config.go | 84.6% <100.0%> (+1.7%) | :arrow_up: | 
| instrumentation/net/http/otelhttp/handler.go | 86.9% <100.0%> (ø) | |
| instrumentation/net/http/otelhttp/wrap.go | 92.5% <100.0%> (+7.4%) | :arrow_up: | 
This would need a changelog, and tests.
This would need a changelog, and tests.
Add tests and changelog.
Hmm CI shows a data race message that I can't reproduce locally.
Hmm CI shows a data race message that I can't reproduce locally.
For reference: https://github.com/open-telemetry/opentelemetry-go-contrib/actions/runs/4883405160/jobs/8714784942
Have you tried running multiple times? E.g. by calling go test -race -count=1000 ?
EDIT: ~~At first glance it looks not related to your changes. If I am correct, then it would be better to create a separate issue for it.~~
EDIT 2: The data race is in your code. https://github.com/open-telemetry/opentelemetry-go-contrib/pull/3769#discussion_r1187378315. PS. I managed to get the data race on my machine (but the probability to hit it is extremely low. I had to run go test -race -count=10000 multiple times in instrumentation/net/http/otelhttp/test directory).
@RangelReale are you still willing to work on this?
yes, I''m available either to follow up or if someone wants to takeover also fine.
yes, I''m available either to follow up or if someone wants to takeover also fine.
It is fine if you follow up. I will do my best to take look in the beginning of next week.
@Aneurysm9, can you please review this PR (as module codeowner)?
Curious if this is currently blocked by anything? Would be awesome to have this merged and released when possible
@RangelReale What is the latest on this? Do you need any help?
@RangelReale What is the latest on this? Do you need any help?
@Sovietaced I've not been following too much the latest changes, if you want to help/assume this fork, it is fine with me.
@Sovietaced I've not been following too much the latest changes, if you want to help/assume this fork, it is fine with me.
Thanks! I have made a fork and will be going through the code tomorrow. I will open up another pull request once I deeply understand the code and have addressed any outstanding comments here.
I have an initial draft of this work continued here: https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4707
Would appreciate any reviews