I installed Prometheus 2 on my machine and using this configuration to publish metrics to another service
remote_write:
basic_auth:
Another service is in Java, should intercept and enrich Prometheus metrics and after that forward them to another Prometheus.
Prometheus publishes traffic with Content-Encoding: snappy, Content-Type: application/x-protobu, X-Prometheus-Remote-Write: 0.1.0 headers
In my service I generated proto java classes against this definition
and I'm trying to parse incoming Prometheus bytes like this WriteRequest.parseFrom(input.getBytes()) and it fails with
com.google.protobuf.InvalidProtocolBufferException$InvalidWireTypeException: Protocol message tag had invalid wire type.
when I try to parse with firstly decoding with Snappy
WriteRequest.parseFrom(Snappy.uncompress(input.getBytes()))
I get error that it is not possible to decompress the message. What am I doing wrong and how to parse Prometheus Protobufs messages properly?
Thanks.