Exemplar Usage

187 views
Skip to first unread message

Sandes de Silva

unread,
Mar 31, 2021, 1:22:34 PM3/31/21
to Prometheus Users
Hi,

I'm trying to use this experimental feature and having no luck. Has anyone here tried it? Is the usage documented anywhere? Here is my setup:

Prom version: built locally off the main branch using docker (rev: 763a0d805c8f7f6e2cbd49c4c2c5e250e9dc5cd2)

CLI options: `--enable-feature=exemplar-storage` and `--storage.exemplars.exemplars-limit=100000` along with the default options provided by CMD directive on the Dockerfile

Metrics:
# HELP request_total Counts total number of requests 
# TYPE request_total counter 
request_total{url="/collection/"} 3 1617208935086 # {trace_id="234234234234234234234"} 1 
request_total{url="/insert/"} 3 1617208935091 # {trace_id="234234234234234234234"} 1
request_total{url="/get/"} 3 1617208935096 # {trace_id="234234234234234234234"} 1

Seems like that's all that is required when I read the source code. However I'm still getting the following error:
level=debug ts=2021-03-31T17:21:48.016Z caller=scrape.go:1149 component="scrape manager" scrape_pool=node target=http://192.168.1.198:9464/metrics msg="Append failed" err="expected next entry after timestamp, got \"MNAME\""

Julien Pivotto

unread,
Mar 31, 2021, 3:41:47 PM3/31/21
to Sandes de Silva, Prometheus Users
Hello,


It seems that you are using the Prometheus text format instead of
Openmetrics.

Which library are you using to produce this? We recommend to use the
official Prometheus client libraries to produce openmetrics format.

>
> --
> 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/447dd8f6-e2a7-4533-a95e-089d6db798b0n%40googlegroups.com.


--
Julien Pivotto
@roidelapluie

Sandes de Silva

unread,
Mar 31, 2021, 3:50:06 PM3/31/21
to Prometheus Users
Hi Julien,


I wanted to add support for exemplars for this library so for now I'm just modifying this method (https://github.com/open-telemetry/opentelemetry-js/blob/853fcb94cd96cea0bd1af18cddb355345f76adad/packages/opentelemetry-exporter-prometheus/src/PrometheusSerializer.ts#L103) to return a plain string compatible with extended exposition format. 

Is changing the text format a configuration change?

Sandes

Sandes de Silva

unread,
Mar 31, 2021, 4:17:59 PM3/31/21
to Prometheus Users

I think I found the issue. I have to add a `content-type` header to the response that has the value `application/openmetrics-text`
Reply all
Reply to author
Forward
0 new messages