kong icon indicating copy to clipboard operation
kong copied to clipboard

[Prometheus plugin] kong_http_status metric does not serve 404 stats if no match

Open 23henne opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Kong version ($ kong version)

2.8.1

Current Behavior

Currently kong_http_status metric will only serve data if there's a match on a route/service.

# HELP kong_http_status HTTP status codes per service/route in Kong
# TYPE kong_http_status counter
kong_http_status{service="service",route="route",code="301"} 51397

IMHO this is misleading as DDoS attacks on targets that don't exist remain undiscovered (at least from Prometheus metrics' POV). Also official grafana chart titles 'Total requests per second (RPS)' which in fact means total is total excluding 'no-matchers' 😉

Expected Behavior

Metric also serves data for 'no-matchers'.

Steps To Reproduce

Run a (load) test on 404 target that does not match a route. It will not be counted in metrics data.

Anything else?

No response

23henne avatar Jul 22 '22 08:07 23henne

Kong will not run plugins associated to a particular Service or Route if the requests received don't correspond to those Services or Routes. Usually that is a desirable behavior.

Is your Prometheus plugin associated to any Service or Route? If that's the case, then that's why it does not report 404 requests. Can you try running it as a global plugin instead (not associated to any Service or Route)?

kikito avatar Jul 22 '22 09:07 kikito

It's been added to global scope.

23henne avatar Jul 22 '22 09:07 23henne

Nobody else seeing relevance for this topic?

23henne avatar Aug 25 '22 06:08 23henne

Dear contributor, We're closing this issue as there hasn't been any update to it for a long time. If the issue is still relevant in the latest version, please feel free to reopen it. We're more than happy to revisit it again. Your contribution is greatly appreciated! Please have a look at our pledge to the community for more information. Sincerely, Kong Gateway Team

StarlightIbuki avatar Oct 11 '23 06:10 StarlightIbuki