-
Notifications
You must be signed in to change notification settings - Fork 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
Remote read/write interfaces use Snappy when they probably shouldn't #2692
Comments
Hi there - we chose snappy intentionally, as a trade off between compression ratio and cpu usage. It was out intention that this should work across languages.
This was suggested in issue #2522. I think this header is correct - the body is protobuf - but we should probably also send
This is concerning. Snappy is supposed to be cross language! Do you some code I can use to reproduce this? if this is indeed true then its a bug in the upstream snappy library IMO. |
It seems you are not the first person to notice this: xerial/snappy-java#175 I've reproduced the issue with a pair of simple test programs here: https://github.com/weaveworks-experiments/prometheus-benchmarks/tree/master/cmd/snappy |
https://github.com/eapache/go-xerial-snappy seems to imply the problem is on xerials end. |
Right, I think the problem is that snappy doesn't specify a streaming format, so each library has their own. I can't find a java library that is compatible with golang/snappy's framing format. I suggest we remove the framing format (we have all the data in memory) and just send the unframed snappy. |
And the content-encoding header has already been added: 3f23aa2 |
I didn't know about Snappy's framing format. https://github.com/google/snappy/blob/master/framing_format.txt says,
...so I think you're right that we have to omit the framing and use |
Yeah its a bit... weird. Even worse, the golang reader/writer can't read the non-framed encoding. So we'll need to bump the remote read/write version header, and detect it using that. PR incoming. |
Thanks for addressing this. Other than the fix for cross-lang Snappy, it will also help that the Content-encoding header is now going to say it's Snappy (in my case it took me a couple of hours to figure out why my protobuf deserializer was not able to read the bytestream). Maybe it would be good to also mention in the docs that it's Snappy encoded. |
(edit) actually looks like I added it ages ago! d838792#diff-ae8db9d16d8057358e49d694522e7186R82 |
Looks like its not there on read though, and it should be. |
Prometheus switched to use unframed Snappy encoding as of version 1.7.0. Upgrade Prometheus in the integration test environment to 1.7.1 and update the remote read API endpoint to accept unframed Snappy-encoded data from Prometheus, and update the acceptance tests to match. See: prometheus/prometheus#2692 https://github.com/prometheus/prometheus/tree/v1.7.0
Prometheus switched to use unframed Snappy encoding as of version 1.7.0. Upgrade Prometheus in the integration test environment to 1.7.1 and update the remote read API endpoint to accept unframed Snappy-encoded data from Prometheus, and update the acceptance tests to match. See: prometheus/prometheus#2692 https://github.com/prometheus/prometheus/tree/v1.7.0
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What did you do?
I implemented a remote_read interface for Prometheus in Java.
What did you expect to see?
I expected to receive Protobuf-encoded remote ReadRequests from Prometheus, but instead...
What did you see instead? Under which circumstances?
Instead of the protobuf binary format, Prometheus' remote read requests are Snappy-compressed data.
First, this is not stated in the Content-type, which says "application/x-protobuf" indicating that it is protobuf binary format, not Snappy.
Second, I am currently not aware of any Java implementation of the Snappy codec that can successfully decode golang-snappy encoded data (I tried both xerial-snappy and dain/snappy and could not make it decompress the golang-snappy encoded data).
Prometheus version:
1.6.1
Prometheus configuration file:
The text was updated successfully, but these errors were encountered: