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

MetricsMiddleware: Set hb_uri to NotFound for 404 errors #499

Merged

Conversation

CallumTodd7
Copy link
Contributor

This PR modifies the MetricsMiddleware to always set a hb_uri dimension, even if the error is a 404. To keep with the spirit of #47, the dimension's value is set to "NotFound" instead of the uri, which would be an unbounded value.

Motivation

  1. Prevents unbounded dimension values using the same method as File middleware should set endpoint if it hits a file #482; hard coding a string instead of dropping the dimension.
  2. Works around an implementation limitation with swift-prometheus where the library detects when the dimension1 set for a metric has changed and crashes the application with a fatalError.

Footnotes

  1. aka label, in Prometheus' terminology

Copy link
Member

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.01%. Comparing base (e78cde7) to head (45d2e78).
Report is 93 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
- Coverage   84.86%   83.01%   -1.86%     
==========================================
  Files          98       94       -4     
  Lines        5320     4280    -1040     
==========================================
- Hits         4515     3553     -962     
+ Misses        805      727      -78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adam-fowler adam-fowler merged commit d29b0de into hummingbird-project:main Jul 1, 2024
6 of 7 checks passed
@CallumTodd7 CallumTodd7 deleted the metrics-not-found-uri branch July 1, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants