-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix incorrect OpenMetrics V2 check exposition format HTTP header #11899
Fix incorrect OpenMetrics V2 check exposition format HTTP header #11899
Conversation
The exposition format to request is set via the "Accept" header. Despite the OpenMetricsScraper appearing to set the correct header when `use_latest_spec` is enabled, it is actually a no-op due to the default HTTP headers including `Accept: */*` and the use of `setdefault`. With this change, the openmetrics check should request the appropriate exposition format fixing "Clashing name" errors.
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
Thanks! What do you think about always just overriding the header?
That's how I approached it at first, but then realized that it may break workflows where a user sets
Another option would be to override the header by setting it on |
da5355e
to
4eebc0d
Compare
@ofek Added some really basic tests. Please let me know if anything else is needed. As for always overriding, happy to switch to that if you think there's never a need to override it via instance configs. |
@ofek just following up since you requested the changes. Happy to implement "always" override path, but want to confirm that it's okay to break the override path that exists today. |
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.
Thanks, great job as always!!!
) * Fix incorrect exposition format header with OpenMetricsV2 check The exposition format to request is set via the "Accept" header. Despite the OpenMetricsScraper appearing to set the correct header when `use_latest_spec` is enabled, it is actually a no-op due to the default HTTP headers including `Accept: */*` and the use of `setdefault`. With this change, the openmetrics check should request the appropriate exposition format fixing "Clashing name" errors. * Add tests d979458
What does this PR do?
With this change, the openmetrics check should request the appropriate
exposition format fixing "Clashing name" errors.
Motivation
The exposition format to request is set via the "Accept" header. Despite
the OpenMetricsScraper appearing to set the correct header when
use_latest_spec
is enabled, it is actually a no-op due to the defaultHTTP headers including
Accept: */*
and the use ofsetdefault
.Additional Notes
Tests incoming. It appears that there were no existing tests of
use_latest_spec
or the new exposition format.Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached