I want to intercept Prometheus 2 traffic in Java. and enrich time-series with my data. Have problems with protobufs deserialization in Java.

35 views
Skip to first unread message

DanQ

unread,
May 10, 2020, 10:45:04 AM5/10/20
to Prometheus Users
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.

sayf eddine Hammemi

unread,
May 10, 2020, 11:08:55 AM5/10/20
to DanQ, Prometheus Users
Hi, preventing an XY problem, can you explain what do you want to achieve by enriching the time series ? Maybe it is done easily with another way

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/435695ae-277f-4b64-8ff7-af7db4843edf%40googlegroups.com.

DanQ

unread,
May 10, 2020, 11:13:35 AM5/10/20
to Prometheus Users
hi, sorry, I can't share exact problem I'm solving and I need to solve it in the way I'm trying to do it.



On Sunday, May 10, 2020 at 6:08:55 PM UTC+3, sayf eddine Hammemi wrote:
Hi, preventing an XY problem, can you explain what do you want to achieve by enriching the time series ? Maybe it is done easily with another way

On Sun, May 10, 2020, 16:45 DanQ wrote:
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.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to promethe...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages