Examplars are available when using the OpenMetrics exposition format.

promhttp.HandlerOpts{
             // Opt into OpenMetrics to support exemplars.
             EnableOpenMetrics: true,
    },


Additionally, you need to use the correct Accept header, e.g.

curl -H 'Accept: application/openmetrics-text; version=0.0.1' 
http://myapp/metrics


Regards,


On 09 Nov 13:29, 'Hao Ke' via Prometheus Users wrote:
> Hi there, 
> I want to use the exemplar feature to expose exemplar to metrics.
> I found the a promising example code here:
> https://github.com/prometheus/client_golang/blob/master/examples/random/main.go#L99
> 
> But when I download and run the whole example, I still can't see exemplar.
> 
> 
> all I got was like 
> 
> ...
> rpc_durations_histogram_seconds_bucket{le="1.0000000000000216e-05"} 11
> rpc_durations_histogram_seconds_bucket{le="0.00011000000000000022"} 14
> rpc_durations_histogram_seconds_bucket{le="0.00021000000000000023"} 16
> rpc_durations_histogram_seconds_bucket{le="0.0003100000000000002"} 17
> rpc_durations_histogram_seconds_bucket{le="0.0004100000000000002"} 19
> rpc_durations_histogram_seconds_bucket{le="0.0005100000000000003"} 19
> ...
> 
> But I was expecting something like 
> 
> rpc_durations_histogram_seconds_bucket{le="0.0005100000000000003"} 19 *# 
> {"dummyID": 
> "xxxxx"}*
> 
> Did I missed anything? 
> 
> -- 
> 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/6ad6d0c5-6d84-4b39-9fb3-8e2b9de5736dn%40googlegroups.com.


-- 
Julien Pivotto
@roidelapluie

-- 
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/20211109225735.GA1245914%40hydrogen.

Reply via email to