*The read and write protocols both use a snappy-compressed protocol buffer 
encoding over HTTP.*
I think you have tried to use plain text metrics, when they need to be 
represented in protobuf binary format (and *then* compressed)

On Wednesday, 23 November 2022 at 13:14:02 UTC [email protected] wrote:

> Here is a set of correct metrics 
>
> cat metrics.prom
> # HELP http_requests_total The total number of HTTP requests.
> # TYPE http_requests_total counter
> http_requests_total{method="post",code="200"} 1027 1395066363000
> http_requests_total{method="post",code="400"}    3 1395066363000
>
> cat metrics.prom | promtool check metrics
>
>
> Then it is supposed to be compressed by snappy as the manual said 
>
> The read and write protocols both use a snappy-compressed protocol buffer 
> encoding over HTTP.
>
>
> So,
>
> snzip metrics.prom
>
>
> Then 
>
> curl  --header "Content-Type: application/openmetrics-text" \
> --header "Content-Encoding: snappy" \
> --request POST \
> --data-binary "@metrics.prom.sz" \
> "http://localhost:9090/api/v1/write";
>
> but unfortunately, the  result is 
>
>
> snappy: corrupt input
>
> Why is it corrupt?
>
> snzip -d  metrics.prom.sz
>
>
> gives perfectly fine result.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/114d9848-b0ba-45bb-9e10-7cb779b3a85dn%40googlegroups.com.

Reply via email to