diff --git a/prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala b/prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala index fb5dcc4..8fe411c 100644 --- a/prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala +++ b/prometheus-metrics/src/main/scala/org/http4s/metrics/prometheus/Prometheus.scala @@ -100,6 +100,17 @@ object Prometheus { metrics <- createMetricsCollection(registry, prefix, responseDurationSecondsHistogramBuckets) } yield createMetricsOps(metrics, Applicative[F].pure(None)) + /** Creates a [[MetricsOps]] that supports Prometheus metrics and records exemplars. + * + * Warning: The sampler effect is responsible for producing exemplar labels that are valid for the underlying + * implementation as errors happening during metric recording will not be handled! For Prometheus version < 1.0, + * this means the combined length of keys and values may not exceed 128 characters and the parts must adhere + * to the label regex Prometheus defines. + * + * @param registry a metrics collector registry + * @param sampleExemplar an effect that returns the corresponding exemplar labels + * @param prefix a prefix that will be added to all metrics + */ def metricsOpsWithExemplars[F[_]: Sync]( registry: CollectorRegistry, sampleExemplar: F[Option[Map[String, String]]],