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 allSolrPrometheusFormatter
holdingMetricSnapshot
s. Can exportMetric
toMetricSnapshot
to be outputted forPrometheusResponseWriter
-
-
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
-
Constructor Summary
Constructors Constructor Description SolrPrometheusFormatter()
-
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)
CategorizeMetric
based on the metric nameio.prometheus.metrics.model.snapshots.MetricSnapshots
collect()
Returns an immutableMetricSnapshots
from theDataPointSnapshot
s collected from the registryvoid
collectCounterDatapoint(String metricName, io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot dataPoint)
CollectsCounterSnapshot.CounterDataPointSnapshot
and appends to existing metric or create new metric if name does not existvoid
collectGaugeDatapoint(String metricName, io.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot dataPoint)
CollectsGaugeSnapshot.GaugeDataPointSnapshot
and appends to existing metric or create new metric if name does not existio.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot
createCounterDatapoint(double value, io.prometheus.metrics.model.snapshots.Labels labels)
Create aCounterSnapshot.CounterDataPointSnapshot
with labelsio.prometheus.metrics.model.snapshots.GaugeSnapshot.GaugeDataPointSnapshot
createGaugeDatapoint(double value, io.prometheus.metrics.model.snapshots.Labels labels)
Create aGaugeSnapshot.GaugeDataPointSnapshot
with labelsvoid
exportCounter(String metricName, com.codahale.metrics.Counter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportCounter
toCounterSnapshot.CounterDataPointSnapshot
and collect datapointabstract void
exportDropwizardMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)
ExportMetric
toMetricSnapshot
and register the Snapshotvoid
exportGauge(String metricName, com.codahale.metrics.Gauge<?> dropwizardMetricRaw, io.prometheus.metrics.model.snapshots.Labels labels)
ExportGauge
toGaugeSnapshot.GaugeDataPointSnapshot
and collect to datapoint.void
exportMeter(String metricName, com.codahale.metrics.Meter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportMeter
toCounterSnapshot.CounterDataPointSnapshot
and collect datapointvoid
exportTimer(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportTimer
ands its mean rate toGaugeSnapshot.GaugeDataPointSnapshot
and collect datapointvoid
exportTimerCount(String metricName, com.codahale.metrics.Timer dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportTimer
ands its Count toCounterSnapshot.CounterDataPointSnapshot
and collect datapoint
-
-
-
Method Detail
-
exportDropwizardMetric
public abstract void exportDropwizardMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)
ExportMetric
toMetricSnapshot
and register the Snapshot- Parameters:
dropwizardMetric
- theMetric
to be exportedmetricName
- Dropwizard metric name
-
categorizeMetric
public abstract SolrMetric categorizeMetric(com.codahale.metrics.Metric dropwizardMetric, String metricName)
CategorizeMetric
based on the metric name- Parameters:
dropwizardMetric
- theMetric
to be exportedmetricName
- Dropwizard metric name
-
exportMeter
public void exportMeter(String metricName, com.codahale.metrics.Meter dropwizardMetric, io.prometheus.metrics.model.snapshots.Labels labels)
ExportMeter
toCounterSnapshot.CounterDataPointSnapshot
and collect datapoint- Parameters:
metricName
- name of metric after exportdropwizardMetric
- theMeter
to 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)
ExportCounter
toCounterSnapshot.CounterDataPointSnapshot
and collect datapoint- Parameters:
metricName
- name of prometheus metricdropwizardMetric
- theCounter
to 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)
ExportTimer
ands its mean rate toGaugeSnapshot.GaugeDataPointSnapshot
and collect datapoint- Parameters:
metricName
- name of prometheus metricdropwizardMetric
- theTimer
to 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)
ExportTimer
ands its Count toCounterSnapshot.CounterDataPointSnapshot
and collect datapoint- Parameters:
metricName
- name of prometheus metricdropwizardMetric
- theTimer
to 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)
ExportGauge
toGaugeSnapshot.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 metricdropwizardMetricRaw
- theGauge
to 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.CounterDataPointSnapshot
with 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.GaugeDataPointSnapshot
with 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.CounterDataPointSnapshot
and 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.GaugeDataPointSnapshot
and 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 immutableMetricSnapshots
from theDataPointSnapshot
s collected from the registry
-
-