Class SolrPrometheusFormatter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Map<String,​List<io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot>> metricCounters  
      protected Map<String,​List<io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot>> metricGauges  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract SolrMetric categorizeMetric​(com.codahale.metrics.Metric dropwizardMetric, String metricName)
      Categorize Metric based on the metric name
      io.prometheus.metrics.model.snapshots.MetricSnapshots collect()
      Returns an immutable MetricSnapshots from the DataPointSnapshots collected from the registry
      void collectCounterDatapoint​(String metricName, io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot dataPoint)
      Collects CounterSnapshot.CounterDataPointSnapshot and appends to existing metric or create new metric if name does not exist
      void collectGaugeDatapoint​(String metricName, io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot dataPoint)
      Collects GaugeSnapshot.GaugeDataPointSnapshot and appends to existing metric or create new metric if name does not exist
      io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot createCounterDatapoint​(double value, io.prometheus.metrics.model.snapshots.Labels labels)
      Create a CounterSnapshot.CounterDataPointSnapshot with labels
      io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot createGaugeDatapoint​(double value, io.prometheus.metrics.model.snapshots.Labels labels)
      Create a GaugeSnapshot.GaugeDataPointSnapshot with labels
      void exportCounter​(String metricName, com.codahale.metrics.Counter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
      Export Counter to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
      abstract void exportDropwizardMetric​(com.codahale.metrics.Metric dropwizardMetric, String metricName)
      Export Metric to MetricSnapshot and register the Snapshot
      void exportGauge​(String metricName, com.codahale.metrics.Gauge<?> dropwizardMetricRaw, io.prometheus.metrics.model.snapshots.Labels labels)
      Export Gauge to GaugeSnapshot.GaugeDataPointSnapshot and collect to datapoint.
      void exportMeter​(String metricName, com.codahale.metrics.Meter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
      Export Meter to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
      void exportTimer​(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
      Export Timer ands its mean rate to GaugeSnapshot.GaugeDataPointSnapshot and collect datapoint
      void exportTimerCount​(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
      Export Timer ands its Count to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
    • Field Detail

      • metricCounters

        protected final Map<String,​List<io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot>> metricCounters
      • metricGauges

        protected final Map<String,​List<io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot>> metricGauges
    • Constructor Detail

      • SolrPrometheusFormatter

        public SolrPrometheusFormatter()
    • Method Detail

      • exportDropwizardMetric

        public abstract void exportDropwizardMetric​(com.codahale.metrics.Metric dropwizardMetric,
                                                    String metricName)
        Export Metric to MetricSnapshot and register the Snapshot
        Parameters:
        dropwizardMetric - the Metric to be exported
        metricName - Dropwizard metric name
      • categorizeMetric

        public abstract SolrMetric categorizeMetric​(com.codahale.metrics.Metric dropwizardMetric,
                                                    String metricName)
        Categorize Metric based on the metric name
        Parameters:
        dropwizardMetric - the Metric to be exported
        metricName - Dropwizard metric name
      • exportMeter

        public void exportMeter​(String metricName,
                                com.codahale.metrics.Meter dropwizardMetric,
                                io.prometheus.metrics.model.snapshots.Labels labels)
        Export Meter to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
        Parameters:
        metricName - name of metric after export
        dropwizardMetric - the Meter to be exported
        labels - label names and values to record
      • exportCounter

        public void exportCounter​(String metricName,
                                  com.codahale.metrics.Counter dropwizardMetric,
                                  io.prometheus.metrics.model.snapshots.Labels labels)
        Export Counter to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
        Parameters:
        metricName - name of prometheus metric
        dropwizardMetric - the Counter to be exported
        labels - label names and values to record
      • exportTimer

        public void exportTimer​(String metricName,
                                com.codahale.metrics.Timer dropwizardMetric,
                                io.prometheus.metrics.model.snapshots.Labels labels)
        Export Timer ands its mean rate to GaugeSnapshot.GaugeDataPointSnapshot and collect datapoint
        Parameters:
        metricName - name of prometheus metric
        dropwizardMetric - the Timer to be exported
        labels - label names and values to record
      • exportTimerCount

        public void exportTimerCount​(String metricName,
                                     com.codahale.metrics.Timer dropwizardMetric,
                                     io.prometheus.metrics.model.snapshots.Labels labels)
        Export Timer ands its Count to CounterSnapshot.CounterDataPointSnapshot and collect datapoint
        Parameters:
        metricName - name of prometheus metric
        dropwizardMetric - the Timer to be exported
        labels - label names and values to record
      • exportGauge

        public void exportGauge​(String metricName,
                                com.codahale.metrics.Gauge<?> dropwizardMetricRaw,
                                io.prometheus.metrics.model.snapshots.Labels labels)
        Export Gauge to GaugeSnapshot.GaugeDataPointSnapshot and collect to datapoint. Unlike other Dropwizard metric types, Gauges can have more complex types. In the case of a hashmap, collect each as an individual metric and have its key appended as a label to the metric called "item"
        Parameters:
        metricName - name of prometheus metric
        dropwizardMetricRaw - the Gauge to be exported
        labels - label names and values to record
      • createCounterDatapoint

        public io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot createCounterDatapoint​(double value,
                                                                                                                     io.prometheus.metrics.model.snapshots.Labels labels)
        Create a CounterSnapshot.CounterDataPointSnapshot with labels
        Parameters:
        value - metric value
        labels - set of name/values labels
      • createGaugeDatapoint

        public io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot createGaugeDatapoint​(double value,
                                                                                                               io.prometheus.metrics.model.snapshots.Labels labels)
        Create a GaugeSnapshot.GaugeDataPointSnapshot with labels
        Parameters:
        value - metric value
        labels - set of name/values labels
      • collectCounterDatapoint

        public void collectCounterDatapoint​(String metricName,
                                            io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot dataPoint)
        Collects CounterSnapshot.CounterDataPointSnapshot and appends to existing metric or create new metric if name does not exist
        Parameters:
        metricName - Name of metric
        dataPoint - Counter datapoint to be collected
      • collectGaugeDatapoint

        public void collectGaugeDatapoint​(String metricName,
                                          io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot dataPoint)
        Collects GaugeSnapshot.GaugeDataPointSnapshot and appends to existing metric or create new metric if name does not exist
        Parameters:
        metricName - Name of metric
        dataPoint - Gauge datapoint to be collected
      • collect

        public io.prometheus.metrics.model.snapshots.MetricSnapshots collect()
        Returns an immutable MetricSnapshots from the DataPointSnapshots collected from the registry