-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add new scraper decorator that adds http code class to OpenMetrics #20528
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
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
dc826af
to
41bff27
Compare
41bff27
to
9b2f6f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! This will be super useful.
What does this PR do?
This PR adds a OpenMetricsScraper decorator that automatically adds
code_class
to the loaded OpenMetrics if an http code tag is configured.It also moves the scraper module to a package preserving the existing import mechanism while allowing it to grow without making the scraper module too big.
Motivation
When dealing with metrics that track HTTP requests it is common to include the response code in the tags. These tags are useful but can contribute to busy dashboards and a common approach is to group them by 2xx, 4xx etc.
The Kuma integration already does this and likely the KrakenD integration will as well. This centralizes the logic of such approach to easily load this in the future.
Why a decorator?
I thought that we might want to do these kind of things often for common practices and having it as a decorator means that we can easily compose them. On top of that is an extension with no impact on the existing scraper.
Review checklist (to be filled by reviewers)
qa/skip-qa
label if the PR doesn't need to be tested during QA.backport/<branch-name>
label to the PR and it will automatically open a backport PR once this one is merged