Class SolrPrometheusFormatter
- java.lang.Object
-
- org.apache.solr.metrics.prometheus.SolrPrometheusFormatter
-
- Direct Known Subclasses:
SolrPrometheusCoreFormatter,SolrPrometheusJettyFormatter,SolrPrometheusJvmFormatter,SolrPrometheusNodeFormatter
public abstract class SolrPrometheusFormatter extends Object
Base class for allSolrPrometheusFormatterholdingMetricSnapshots. Can exportMetrictoMetricSnapshotto be outputted forPrometheusResponseWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,List<io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot>>metricCountersprotected Map<String,List<io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot>>metricGauges
-
Constructor Summary
Constructors Constructor Description SolrPrometheusFormatter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract SolrMetriccategorizeMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)CategorizeMetricbased on the metric nameio.prometheus.metrics.model.snapshots.MetricSnapshotscollect()Returns an immutableMetricSnapshotsfrom theDataPointSnapshots collected from the registryvoidcollectCounterDatapoint(String metricName, io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot dataPoint)CollectsCounterSnapshot.CounterDataPointSnapshotand appends to existing metric or create new metric if name does not existvoidcollectGaugeDatapoint(String metricName, io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot dataPoint)CollectsGaugeSnapshot.GaugeDataPointSnapshotand appends to existing metric or create new metric if name does not existio.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshotcreateCounterDatapoint(double value, io.prometheus.metrics.model.snapshots.Labels labels)Create aCounterSnapshot.CounterDataPointSnapshotwith labelsio.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshotcreateGaugeDatapoint(double value, io.prometheus.metrics.model.snapshots.Labels labels)Create aGaugeSnapshot.GaugeDataPointSnapshotwith labelsvoidexportCounter(String metricName, com.codahale.metrics.Counter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)ExportCountertoCounterSnapshot.CounterDataPointSnapshotand collect datapointabstract voidexportDropwizardMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)ExportMetrictoMetricSnapshotand register the SnapshotvoidexportGauge(String metricName, com.codahale.metrics.Gauge<?> dropwizardMetricRaw, io.prometheus.metrics.model.snapshots.Labels labels)ExportGaugetoGaugeSnapshot.GaugeDataPointSnapshotand collect to datapoint.voidexportMeter(String metricName, com.codahale.metrics.Meter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)ExportMetertoCounterSnapshot.CounterDataPointSnapshotand collect datapointvoidexportTimer(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)ExportTimerands its mean rate toGaugeSnapshot.GaugeDataPointSnapshotand collect datapointvoidexportTimerCount(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)ExportTimerands its Count toCounterSnapshot.CounterDataPointSnapshotand collect datapoint
-
-
-
Method Detail
-
exportDropwizardMetric
public abstract void exportDropwizardMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)ExportMetrictoMetricSnapshotand register the Snapshot- Parameters:
dropwizardMetric- theMetricto be exportedmetricName- Dropwizard metric name
-
categorizeMetric
public abstract SolrMetric categorizeMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)
CategorizeMetricbased on the metric name- Parameters:
dropwizardMetric- theMetricto be exportedmetricName- Dropwizard metric name
-
exportMeter
public void exportMeter(String metricName, com.codahale.metrics.Meter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportMetertoCounterSnapshot.CounterDataPointSnapshotand collect datapoint- Parameters:
metricName- name of metric after exportdropwizardMetric- theMeterto be exportedlabels- label names and values to record
-
exportCounter
public void exportCounter(String metricName, com.codahale.metrics.Counter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportCountertoCounterSnapshot.CounterDataPointSnapshotand collect datapoint- Parameters:
metricName- name of prometheus metricdropwizardMetric- theCounterto be exportedlabels- label names and values to record
-
exportTimer
public void exportTimer(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportTimerands its mean rate toGaugeSnapshot.GaugeDataPointSnapshotand collect datapoint- Parameters:
metricName- name of prometheus metricdropwizardMetric- theTimerto be exportedlabels- label names and values to record
-
exportTimerCount
public void exportTimerCount(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportTimerands its Count toCounterSnapshot.CounterDataPointSnapshotand collect datapoint- Parameters:
metricName- name of prometheus metricdropwizardMetric- theTimerto be exportedlabels- label names and values to record
-
exportGauge
public void exportGauge(String metricName, com.codahale.metrics.Gauge<?> dropwizardMetricRaw, io.prometheus.metrics.model.snapshots.Labels labels)
ExportGaugetoGaugeSnapshot.GaugeDataPointSnapshotand 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 metricdropwizardMetricRaw- theGaugeto be exportedlabels- 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 aCounterSnapshot.CounterDataPointSnapshotwith labels- Parameters:
value- metric valuelabels- 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 aGaugeSnapshot.GaugeDataPointSnapshotwith labels- Parameters:
value- metric valuelabels- set of name/values labels
-
collectCounterDatapoint
public void collectCounterDatapoint(String metricName, io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot dataPoint)
CollectsCounterSnapshot.CounterDataPointSnapshotand appends to existing metric or create new metric if name does not exist- Parameters:
metricName- Name of metricdataPoint- Counter datapoint to be collected
-
collectGaugeDatapoint
public void collectGaugeDatapoint(String metricName, io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot dataPoint)
CollectsGaugeSnapshot.GaugeDataPointSnapshotand appends to existing metric or create new metric if name does not exist- Parameters:
metricName- Name of metricdataPoint- Gauge datapoint to be collected
-
collect
public io.prometheus.metrics.model.snapshots.MetricSnapshots collect()
Returns an immutableMetricSnapshotsfrom theDataPointSnapshots collected from the registry
-
-