From 742b8b20d79219429f8e5fae2a6143be93183ecc Mon Sep 17 00:00:00 2001 From: Chris Marchbanks Date: Thu, 6 Jul 2023 12:28:00 -0600 Subject: [PATCH] Add documentation for how to export exemplars Expand our exemplar documentation to include information for how to use the appropriate exposition code and mention the feature flag required in Prometheus to ingest exemplars. Signed-off-by: Chris Marchbanks --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 0f3cb45d..dcbd7916 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,20 @@ h = Histogram('request_latency_seconds', 'Description of histogram') h.observe(4.7, {'trace_id': 'abc123'}) ``` +Exemplars are only rendered in the OpenMetrics exposition format. If using the +HTTP server or apps in this library, content negotiation can be used to specify +OpenMetrics (which is done by default in Prometheus). Otherwise it will be +necessary to use `generate_latest` from +`prometheus_client.openmetrics.exposition` to view exemplars. + +To view exemplars in Prometheus it is also necessary to enable the the +exemplar-storage feature flag: +``` +--enable-feature=exemplar-storage +``` +Additional information is available in [the Prometheus +documentation](https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage). + ### Disabling `_created` metrics By default counters, histograms, and summaries export an additional series