-
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
http.server.duration metric includes high cardinality attr: http.client_ip #3765
Comments
We should split the |
+1 This results in the high cardinality of request metrics and memory leak in our project. Currently, I am adding the workaround to set req.RemoteAddr to empty before calling otelhttp middleware. But, I hope it will be fixed in the next release. |
Another workaround is to get back to |
# Description otelhttp has the high cardinality problem which record all remote address from client. This issue is tracked by open-telemetry/opentelemetry-go-contrib#3765 . This PR is adding workaround to prevent otelhttp from recording remoteaddr as an attribute. ## Issue reference <!-- We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation. --> #5299 #5237 ## Checklist Please make sure you've completed the relevant tasks for this PR, out of the following list: * [ ] Code compiles correctly * [ ] Adds necessary unit tests for change * [ ] Adds necessary E2E tests for change * [ ] Unit tests passing * [ ] Extended the documentation / Created issue for it --------- Co-authored-by: Yetkin Timocin <[email protected]>
Ran into this issue, which I imagine most folks are going to hit when upgrading. It is also applicable to |
It doesn't work for my case. The older one doesn't emit status code I need to use. I am filtering out req.RemoteAddr now. |
This is causing issues in our production environment. Our service is not reporting metrics due to the gRPC message too large. I converted the oversized gRPC message into JSON and found It seems Should we consider using a new set of attributes and limit cardinality for metrics? opentelemetry-go-contrib/instrumentation/net/http/otelhttp/handler.go Lines 226 to 233 in 65caeb1
|
We've had to implement our own middleware to remove these labels from metrics. There needs to be a clear distinction between attributes that are not safe for metrics but are fine for tracing. |
dmathieu said in its comment about a feature called "view", being discussed in open-telemetry/opentelemetry-specification#3061, and seems reasonable. |
Thanks @dmathieu We recently upgraded to the latest metric SDK versions (was a pain 😅) and have started using views. It seems the Go Metric SDK does support a attribute filter function you can apply to a view: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#Stream So this should already be possible to achieve and does seem like a nice solution, thanks for the hint 🙌 |
is this still considered an issue with the instrumentation library? Or with the way the The spec makes a clear distinction between metric and traces attributes so it feels this instrumentation should as well? |
I believe this is fixed by #4277 ? |
Yes. |
Meaning that there are as many timeseries as you have visitors. Other http.server.* metrics have the same problem.
Those metrics also include such attrs as http.user_agent, net.sock.peer.addr, net.sock.peer.port, which should also be removed.
The text was updated successfully, but these errors were encountered: