-
Notifications
You must be signed in to change notification settings - Fork 837
Added compression support in pushgateway #1144
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
base: master
Are you sure you want to change the base?
Added compression support in pushgateway #1144
Conversation
Signed-off-by: ritesh-avesha <ritesh@aveshasystems.com>
4e71a82 to
fd91251
Compare
csmarchbanks
left a comment
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!
A few comments but generally excited to see this work. Plus it looks like some linters are failing.
| for k, v in sorted(grouping_key.items())) | ||
|
|
||
| data = b'' | ||
| headers = [('Content-Type', CONTENT_TYPE_PLAIN_0_0_4)] |
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.
I don't love defining this default header in two places, perhaps append here? Or does delete even need this header as there is no content type?
| try: | ||
| import snappy | ||
| except ImportError as exc: | ||
| raise RuntimeError('Snappy compression requires the python-snappy package to be installed.') from exc |
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.
Trying an import on each request feels a bit slow, could we do this once and then have a variable for if snappy is enabled or not?
| self.assertEqual(decompressed, b'# HELP g help\n# TYPE g gauge\ng 0.0\n') | ||
|
|
||
| def test_push_with_snappy_compression(self): | ||
| snappy = pytest.importorskip('snappy') |
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.
It would be good to add snappy to one of the test envs such as
Line 11 in 1783ca8
| {py3.9,pypy3.9}: twisted |
Pushgateway (version >= 1.5.0) supports gzip and snappy compression (v > 1.6.0). This helps optimizing in network constrained environments
compressionargument (gzip/snappy) topush_to_gatewayandpushadd_to_gateway@csmarchbanks