-
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
otelhttp: client metrics #4707
otelhttp: client metrics #4707
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4707 +/- ##
=======================================
+ Coverage 79.7% 80.3% +0.5%
=======================================
Files 151 151
Lines 9959 10209 +250
=======================================
+ Hits 7946 8201 +255
+ Misses 1859 1854 -5
Partials 154 154
|
422e763
to
4351562
Compare
instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go
Outdated
Show resolved
Hide resolved
079f76a
to
dd0a2fd
Compare
We are fine. From https://pkg.go.dev/net/http:
Also we already have this requirement for trace instrumentation. Side note: probably we should call it out in package documentation. |
We want to first be be compliant with the v1.20 semantic conventions. Next semantic convention versions have many breaking changes and we want to help a little with the migration. |
Please add a changelog entry. |
Will do, I didn't add one since you seemed a bit picky about the changelog entries on my last PR :) |
22539b3
to
2b2c02e
Compare
bdf65dd
to
50aa699
Compare
@dmathieu @Aneurysm9 @dashpole @hanyuancheung Please take a look when you have a chance. TY |
instrumentation/google.golang.org/grpc/otelgrpc/example/api/hello-service.pb.go
Outdated
Show resolved
Hide resolved
50aa699
to
f54fc6c
Compare
adaeed4
to
70c1791
Compare
@pellared should be good to go |
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.
Little comments that I would like to have addressed. Besides looks good 👍
Co-authored-by: Robert Pająk <[email protected]>
Co-authored-by: Robert Pająk <[email protected]>
It would be nice to have something similar to |
@Sovietaced Thank you for your contribution |
Maybe create a separate issue for this? |
Hi, it would be great if new features like metrics are built behind a feature flag. For example, we use the middleware for everything expect metrics. As a workaround, we pass a Noop meter. |
@@ -50,8 +50,8 @@ func assertScopeMetrics(t *testing.T, sm metricdata.ScopeMetrics, attrs attribut | |||
require.Len(t, sm.Metrics, 3) | |||
|
|||
want := metricdata.Metrics{ | |||
Name: "http.server.request_content_length", | |||
Description: "Measures the size of HTTP request content length (uncompressed)", | |||
Name: "http.server.request.size", |
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.
@pellared This looks to me like a breaking change. Why wasn't it communicated as such?
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.
@sharptech sorry about that. I've opened #4898 to add it to the changelog.
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.
Hi @dashpole wouldn't it be better to rollback so the deprecation statements remains true? I saw that the old name isn't used at all in the code. I also think breaking stuff with a feature release isn't the right approach.
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.
The deprecation statements refer to these constants: https://github.com/open-telemetry/opentelemetry-go-contrib/pull/4707/files#diff-be9e2412d1919396470e196d2be4bddf6997059892167fd8381a9cfa478933faR34
I also think breaking stuff with a feature release isn't the right approach.
The otelhttp module is not stable, and is still released under a v0.* version, so breaking changes are expected. You can see the versioning policy here: https://github.com/open-telemetry/opentelemetry-go/blob/main/VERSIONING.md. The telemetry in otelhttp follows the semantic conventions for http metrics: https://opentelemetry.io/docs/specs/semconv/http/http-metrics/, so breaking changes to conventions require us to make breaking changes here.
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.
I understand, but users like me running this in production. We need to deprecate fields before we can upgrade. If I would want to use the new metrics I couldn't. I'm saying the feature and the breaking change could have been shipped in two PR (releases).
This pull request attempts to follow up on the work that @RangelReale did in #3769 and close out the work. This pull request adds support for http client metrics that mostly adhere to the v1.20 semantic conventions. In many ways this code attempts to mirror the http server metric code in implementation.
As such, it reuses the HTTP request body wrapper logic and introduces HTTP response body wrapper logic with callbacks to record metrics once the response body has been read.
Open Questions:
Fixes #3134
Fixes #1336