opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

[otelhttp] transport metrics

Open RangelReale opened this issue 2 years ago • 14 comments

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

RangelReale avatar May 03 '23 13:05 RangelReale

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 is 94.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

Impacted file tree graph

@@          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:

... and 3 files with indirect coverage changes

codecov[bot] avatar May 04 '23 01:05 codecov[bot]

This would need a changelog, and tests.

dmathieu avatar May 04 '23 08:05 dmathieu

This would need a changelog, and tests.

Add tests and changelog.

RangelReale avatar May 04 '23 12:05 RangelReale

Hmm CI shows a data race message that I can't reproduce locally.

RangelReale avatar May 04 '23 14:05 RangelReale

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).

pellared avatar May 08 '23 11:05 pellared

@RangelReale are you still willing to work on this?

pellared avatar Jul 27 '23 15:07 pellared

yes, I''m available either to follow up or if someone wants to takeover also fine.

RangelReale avatar Jul 27 '23 15:07 RangelReale

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.

pellared avatar Jul 27 '23 16:07 pellared

@Aneurysm9, can you please review this PR (as module codeowner)?

pellared avatar Aug 10 '23 08:08 pellared

Curious if this is currently blocked by anything? Would be awesome to have this merged and released when possible

jlordiales avatar Sep 04 '23 19:09 jlordiales

@RangelReale What is the latest on this? Do you need any help?

Sovietaced avatar Dec 12 '23 19:12 Sovietaced

@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.

RangelReale avatar Dec 15 '23 11:12 RangelReale

@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.

Sovietaced avatar Dec 17 '23 04:12 Sovietaced

I have an initial draft of this work continued here: https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4707

Would appreciate any reviews

Sovietaced avatar Dec 17 '23 21:12 Sovietaced