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

Request prometheus endpoints to be gzipped by default #20766

Merged
merged 2 commits into from
Aug 26, 2020

Conversation

vjsamuel
Copy link
Contributor

@vjsamuel vjsamuel commented Aug 25, 2020

  • Enhancement

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

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Aug 25, 2020
@elasticmachine
Copy link
Collaborator

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
@elasticmachine
Copy link
Collaborator

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?

@elasticmachine
Copy link
Collaborator

elasticmachine commented Aug 25, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [exekias commented: jenkins run the tests]

  • Start Time: 2020-08-26T07:35:18.939+0000

  • Duration: 67 min 21 sec

Test stats 🧪

Test Results
Failed 0
Passed 2709
Skipped 587
Total 3296

@exekias exekias added enhancement review Team:Platforms Label for the Integrations - Platforms team labels Aug 25, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Aug 25, 2020
Copy link
Contributor

@exekias exekias left a 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")
Copy link
Contributor

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
}
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. PTAL

@exekias
Copy link
Contributor

exekias commented Aug 26, 2020

jenkins run the tests

@jsoriano jsoriano added needs_backport PR is waiting to be backported to other branches. v7.10.0 labels Aug 26, 2020
@exekias exekias merged commit fbaeefe into elastic:master Aug 26, 2020
@exekias exekias removed the needs_backport PR is waiting to be backported to other branches. label Aug 26, 2020
exekias pushed a commit to exekias/beats that referenced this pull request Aug 26, 2020
* Request prometheus endpoints to be gzipped by default

(cherry picked from commit fbaeefe)
exekias pushed a commit that referenced this pull request Aug 27, 2020
* Request prometheus endpoints to be gzipped by default

(cherry picked from commit fbaeefe)

Co-authored-by: Vijay Samuel <vjsamuel@ebay.com>
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
* Request prometheus endpoints to be gzipped by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement review Team:Platforms Label for the Integrations - Platforms team v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants