Count HTTP statuses returned along with the HTTP response times - #560
Conversation
Signed-off-by: Ken Dombeck <kdombeck@gmail.com>
3fe39ec to
5343921
Compare
| .name(metricName) | ||
| .register(); | ||
|
|
||
| statusCounter = Counter.build(metricName + "_status", "HTTP status codes of " + help) |
There was a problem hiding this comment.
Counters should end in _total
Having a label name in a metric name is generally an anti-pattern, as it won't make sense if that label is aggregated away. It may be okay here though.
There was a problem hiding this comment.
I remove status from the metric name. It will now look like this
# HELP http_request_status HTTP status codes of The time taken fulfilling servlet requests
# TYPE http_request_status counter
http_request_total{path="/my/api/1",method="GET",status="200",} 4.0
http_request_total{path="/my/api/2",method="GET",status="500",} 2.0
There was a problem hiding this comment.
That'd end up kinda clashing with the histogram though, which isn't desirable.
There was a problem hiding this comment.
I added status back in. It will now look like this.
# HELP http_request_status HTTP status codes of The time taken fulfilling servlet requests
# TYPE http_request_status counter
http_request_status_total{path="/my/api/1",method="GET",status="200",} 4.0
http_request_status_total{path="/my/api/2",method="GET",status="500",} 2.0
I took your "may be okay here though" as a sign that you wanted it removed.
There was a problem hiding this comment.
I do want it removed, but we can't for other reasons :)
Signed-off-by: Ken Dombeck <kdombeck@gmail.com>
Signed-off-by: Ken Dombeck <kdombeck@gmail.com>
|
Thanks! |
|
When can we expect this to hit the official maven repository? 0.9.0 is the latest I can see and it is from May 2020: https://mvnrepository.com/artifact/io.prometheus/simpleclient |
This will add metrics for HTTP status codes like the following along side the existing Histogram.
@brian-brazil I currently have the code deriving the name and help for the Counter from the existing parameters that are used in the constructor or init. Would you prefer I add 2 new parameters for the name and help for the counter or leave it like it is?