Class PrometheusStatsCollector

java.lang.Object
io.prometheus.client.Collector
io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector
All Implemented Interfaces:
io.prometheus.client.Collector.Describable

public final class PrometheusStatsCollector extends io.prometheus.client.Collector implements io.prometheus.client.Collector.Describable
OpenCensus Metrics Collector for Prometheus.
Since:
0.12
  • Nested Class Summary

    Nested classes/interfaces inherited from class io.prometheus.client.Collector

    io.prometheus.client.Collector.Describable, io.prometheus.client.Collector.MetricFamilySamples, io.prometheus.client.Collector.Type
  • Field Summary

    Fields inherited from class io.prometheus.client.Collector

    MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.prometheus.client.Collector.MetricFamilySamples>
     
    static void
    Creates a PrometheusStatsCollector and registers it to Prometheus CollectorRegistry.defaultRegistry.
    static void
    Creates a PrometheusStatsCollector and registers it to the given Prometheus CollectorRegistry in the PrometheusStatsConfiguration.
    List<io.prometheus.client.Collector.MetricFamilySamples>
     

    Methods inherited from class io.prometheus.client.Collector

    checkMetricLabelName, checkMetricName, collect, doubleToGoString, register, register, sanitizeMetricName

    Methods inherited from class Object

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

    • createAndRegister

      public static void createAndRegister()
      Creates a PrometheusStatsCollector and registers it to Prometheus CollectorRegistry.defaultRegistry.

      This is equivalent with:

      PrometheusStatsCollector.createAndRegister(PrometheusStatsConfiguration.builder().build());
      
      Throws:
      IllegalArgumentException - if a PrometheusStatsCollector has already been created and registered.
      Since:
      0.12
    • createAndRegister

      public static void createAndRegister(PrometheusStatsConfiguration configuration)
      Creates a PrometheusStatsCollector and registers it to the given Prometheus CollectorRegistry in the PrometheusStatsConfiguration.

      If CollectorRegistry of the configuration is not set, the collector will use CollectorRegistry.defaultRegistry.

      Throws:
      IllegalArgumentException - if a PrometheusStatsCollector has already been created and registered.
      Since:
      0.13
    • collect

      public List<io.prometheus.client.Collector.MetricFamilySamples> collect()
      Specified by:
      collect in class io.prometheus.client.Collector
    • describe

      public List<io.prometheus.client.Collector.MetricFamilySamples> describe()
      Specified by:
      describe in interface io.prometheus.client.Collector.Describable