Package

org.http4s.metrics

prometheus

Permalink

package prometheus

Visibility
  1. Public
  2. All

Type Members

  1. case class MetricsCollection(responseDuration: Histogram, activeRequests: Gauge, requests: Counter, abnormalTerminations: Histogram) extends Product with Serializable

    Permalink
  2. final class PrometheusExportService[F[_]] extends AnyRef

    Permalink

Value Members

  1. object Prometheus

    Permalink

    MetricsOps algebra capable of recording Prometheus metrics

    MetricsOps algebra capable of recording Prometheus metrics

    For example, the following code would wrap a org.http4s.HttpRoutes with a org.http4s.server.middleware.Metrics that records metrics to a given metric registry.

    import org.http4s.client.middleware.Metrics
    import org.http4s.client.prometheus.Prometheus
    
    val meteredRoutes = Metrics[IO](Prometheus(registry, "server"))(testRoutes)

    Analogously, the following code would wrap a org.http4s.client.Client with a org.http4s.client.middleware.Metrics that records metrics to a given metric registry, classifying the metrics by HTTP method.

    import org.http4s.client.middleware.Metrics
    import org.http4s.client.prometheus.Prometheus
    
    val classifierFunc = (r: Request[IO]) => Some(r.method.toString.toLowerCase)
    val meteredClient = Metrics(Prometheus(registry, "client"), classifierFunc)(client)

    Registers the following metrics:

    {prefix}_response_duration_seconds{labels=classifier,method,phase} - Histogram

    {prefix}_active_request_count{labels=classifier} - Gauge

    {prefix}_request_count{labels=classifier,method,status} - Counter

    {prefix}_abnormal_terminations{labels=classifier,termination_type} - Histogram

    Labels --

    method: Enumeration values: get, put, post, head, move, options, trace, connect, delete, other

    phase: Enumeration values: headers, body

    code: Enumeration values: 1xx, 2xx, 3xx, 4xx, 5xx

    termination_type: Enumeration values: abnormal, error, timeout

  2. object PrometheusExportService

    Permalink

Ungrouped