Class PrometheusMetricsTrackerFactory

  • All Implemented Interfaces:
    MetricsTrackerFactory

    public class PrometheusMetricsTrackerFactory
    extends Object
    implements MetricsTrackerFactory
    
     HikariConfig config = new HikariConfig();
     config.setMetricsTrackerFactory(new PrometheusMetricsTrackerFactory());
     
    or
    
     config.setMetricsTrackerFactory(new PrometheusMetricsTrackerFactory(new CollectorRegistry()));
     
    Note: the internal Summary requires heavy locks. Consider using PrometheusHistogramMetricsTrackerFactory if performance plays a role and you don't need the summary per se.
    • Constructor Detail

      • PrometheusMetricsTrackerFactory

        public PrometheusMetricsTrackerFactory()
        Default Constructor. The Hikari metrics are registered to the default collector registry (CollectorRegistry.defaultRegistry).
      • PrometheusMetricsTrackerFactory

        public PrometheusMetricsTrackerFactory​(io.prometheus.client.CollectorRegistry collectorRegistry)
        Constructor that allows to pass in a CollectorRegistry to which the Hikari metrics are registered.
        Parameters:
        collectorRegistry - the collector registry to register the metrics to