Improve HTTP method label handling in prometheus metrics
What this PR does / why we need it:
This PR fixes #10208 by checking whether the request method is valid. For invalid methods we set method="invalid_method" label so that operators can stil see traffic in the metrics but without unbound label value.
Types of changes
-
Bug fix (non-breaking change which fixes an issue) -
New feature (non-breaking change which adds functionality) -
CVE Report (Scanner found CVE and adding report) -
Breaking change (fix or feature that would cause existing functionality to change) -
Documentation only
How Has This Been Tested?
I tested by building the image locally using make build && make image and running the image in minikube.
The change has a fairly narrow scope so should be low risk.
Checklist:
-
My change requires a change to the documentation. -
I have updated the documentation accordingly. -
I've read the CONTRIBUTION guide -
I have added unit and/or e2e tests to cover my changes. -
All new and existing tests passed.