Class PrometheusEndpoint

java.lang.Object
io.micronaut.configuration.metrics.micrometer.prometheus.management.PrometheusEndpoint

@Endpoint("prometheus") public class PrometheusEndpoint extends Object
Adds a management endpoint for Prometheus.
Since:
1.1
Author:
graemerocher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PrometheusEndpoint(io.micrometer.prometheusmetrics.PrometheusMeterRegistry prometheusMeterRegistry)
     
    PrometheusEndpoint(io.micrometer.prometheusmetrics.PrometheusMeterRegistry prometheusMeterRegistry, ExecutorService scrapeExecutor)
    Deprecated, for removal: This API element is subject to removal in a future version.
    The scrape no longer runs on a separate executor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Use the streamed endpoint response instead.
    Scrapes the data.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • PrometheusEndpoint

      @Inject public PrometheusEndpoint(io.micrometer.prometheusmetrics.PrometheusMeterRegistry prometheusMeterRegistry)
      Parameters:
      prometheusMeterRegistry - The meter registry
    • PrometheusEndpoint

      @Deprecated(since="6.1.1", forRemoval=true) public PrometheusEndpoint(io.micrometer.prometheusmetrics.PrometheusMeterRegistry prometheusMeterRegistry, ExecutorService scrapeExecutor)
      Deprecated, for removal: This API element is subject to removal in a future version.
      The scrape no longer runs on a separate executor. Use PrometheusEndpoint(PrometheusMeterRegistry).
      Parameters:
      prometheusMeterRegistry - The meter registry
      scrapeExecutor - Not used. The scrape is written on the thread that handles the request.
  • Method Details

    • scrape

      @Deprecated(since="6.0") public String scrape()
      Deprecated.
      Use the streamed endpoint response instead.
      Scrapes the data.
      Returns:
      the data
    • scrapeStream

      @Read(produces="text/plain; version=0.0.4") @ExecuteOn("blocking") public InputStream scrapeStream()
      Scrapes the data.

      The scrape is written to an in-memory buffer on the calling thread, and the returned stream reads from that buffer. The endpoint runs on the TaskExecutors.BLOCKING executor so that large scrapes do not block the event loop.

      Returns:
      the data