-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Request prometheus endpoints to be gzipped by default #20766
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
1 similar comment
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
365e323
to
eb6babd
Compare
Pinging @elastic/integrations-platforms (Team:Platforms) |
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.
Thank you so much for your contribution @vjsamuel! This should greatly improve request times
@@ -63,19 +64,31 @@ func NewPrometheusClient(base mb.BaseMetricSet) (Prometheus, error) { | |||
} | |||
|
|||
http.SetHeaderDefault("Accept", acceptHeader) | |||
http.SetHeader("Accept-Encoding", "gzip") |
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.
Could you use SetHeaderDefault
? The reason is that this way, the header can be overridden by users from the config
reader, err = gzip.NewReader(resp.Body) | ||
if err != nil { | ||
return nil, err | ||
} |
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.
We need to add a deferred reader.Close() here
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.
done. PTAL
95057a3
to
5321417
Compare
jenkins run the tests |
* Request prometheus endpoints to be gzipped by default (cherry picked from commit fbaeefe)
* Request prometheus endpoints to be gzipped by default (cherry picked from commit fbaeefe) Co-authored-by: Vijay Samuel <[email protected]>
* Request prometheus endpoints to be gzipped by default
What does this PR do?
This PR ensures that we add gzip content type to all prometheus endpoint poll requests.
Why is it important?
This improves performance network performance as most of the payload of exposition format compresses really well.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist