nginxinc / nginx-prometheus-exporter

NGINX Prometheus Exporter for NGINX and NGINX Plus
Apache License 2.0
1.61k stars 341 forks source link

Missing 4xx code metrics? #796

Closed reubenavery closed 2 months ago

reubenavery commented 2 months ago

Describe the bug

This might be a feature request, but I would think it'd be a common enough use-case to expect 4xx errors to get emitted along with 2xx and 5xx which it seems so far for me to be the only code labels I am able to aggregate by

nginx-bot[bot] commented 2 months ago

Hi @reubenavery! Welcome to the project! 🎉

Thanks for opening this issue! Be sure to check out our Contributing Guidelines and the Issue Lifecycle while you wait for someone on the team to take a look at this.

lucacome commented 2 months ago

Hi @reubenavery

Are you talking about promhttp_metric_handler_requests_total in the https://github.com/nginxinc/nginx-prometheus-exporter#common-metrics ?

reubenavery commented 2 months ago

correct @lucacome thanks for the reply, talking about promhttp_metric_handler_requests_total

lucacome commented 2 months ago

@reubenavery the metrics handler just counts the number of scrapes from the Prometheus server on /metrics and it can never have 4xxs

You can see a response from the maintainers of the library here https://groups.google.com/g/prometheus-users/c/l2WskXthbjY/m/25Yf8y12AgAJ

reubenavery commented 2 months ago

ah, thank you @lucacome

reubenavery commented 2 months ago

I'm missing something clearly. The promhttp_metric_handler_requests_total metric is the only http counter one I was able to detect. Looking at the output of /metrics, I only have these two promhttp_ metrics showing up:

[...]
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 45
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0
reubenavery commented 2 months ago

I'm beginning to figure out this is what nginxplus is about... closing, thank you all for the help