java.lang.Object
io.prometheus.metrics.simpleclient.bridge.SimpleclientCollector
All Implemented Interfaces:
io.prometheus.metrics.model.registry.MultiCollector

public class SimpleclientCollector extends Object implements io.prometheus.metrics.model.registry.MultiCollector
Bridge from simpleclient (version 0.16.0 and older) to the new prometheus-metrics (version 1.0.0 and newer).

Usage: The following line will register all metrics from a simpleclient CollectorRegistry.defaultRegistry to a prometheus-metrics PrometheusRegistry.defaultRegistry:


 SimpleclientCollector.builder().register();
 

If you have custom registries (not the default registries), use the following snippet:


 CollectorRegistry simpleclientRegistry = ...;
 PrometheusRegistry prometheusRegistry = ...;
 SimpleclientCollector.builder()
     .collectorRegistry(simpleclientRegistry)
     .register(prometheusRegistry);
 
  • Method Details

    • collect

      public io.prometheus.metrics.model.snapshots.MetricSnapshots collect()
      Specified by:
      collect in interface io.prometheus.metrics.model.registry.MultiCollector
    • builder

      public static SimpleclientCollector.Builder builder(io.prometheus.metrics.config.PrometheusProperties config)
      Currently there are no configuration options for the SimpleclientCollector. However, we want to follow the pattern to pass the config everywhere so that we can introduce config options later without the need for API changes.
    • builder

      public static SimpleclientCollector.Builder builder()