Skip to content
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

Add status code to net/http metrics #711

Closed
nabokihms opened this issue Mar 24, 2021 · 1 comment
Closed

Add status code to net/http metrics #711

nabokihms opened this issue Mar 24, 2021 · 1 comment

Comments

@nabokihms
Copy link

nabokihms commented Mar 24, 2021

Hello! I have a minor request for improvement for one of the instrumentation packages.

My use-case:
There is a service, and I want to know the percentage of failed requests on it. Previously there was the combination of httpsnoop and Prometheus client_go to capture status code and add it to metrics as a label.

The net/http handler wrapper already extracts status code from the response writer but adds it only to span. See here. And there is a useful labeler, but it can only add some constant labels or information from a user's request, e.g., path, URL.

Maybe it is not a good idea to add status code to metric labels by default because of increasing metrics cardinality. I thought about adding an option to configure it somehow.

So, there are two questions left regarding all this:

  1. Is it ok to add status code to metrics? I think it is if you want to use the RED method and differentiate E's.
  2. Looking through the code, it is not clear how to fulfill this request, but I hope that someone can give me a hint.
@nabokihms
Copy link
Author

Closed by #3182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants