Class PrometheusMetricProvider
java.lang.Object
org.opendaylight.serviceutils.metrics.prometheus.impl.PrometheusMetricProvider
- All Implemented Interfaces:
AutoCloseable
,MetricProvider
@Singleton
public final class PrometheusMetricProvider
extends Object
implements MetricProvider, AutoCloseable
Implementation of
MetricProvider
based on Prometheus.IO.- Author:
- Michael Vorburger.ch
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
newCounter
(Object anchor, String id) Deprecated, for removal: This API element is subject to removal in a future version.newCounter
(MetricDescriptor descriptor) Create new Counter metric without labels.newCounter
(MetricDescriptor descriptor, String labelName) Create new Counter metric with 1 label.newCounter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Create new Counter metric with 2 labels.newCounter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName) Create new Counter metric with 3 labels.newCounter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName) Create new Counter metric with 4 labels.newCounter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName, String fifthLabelName) Create new Counter metric with 5 labels.Deprecated, for removal: This API element is subject to removal in a future version.newMeter
(MetricDescriptor descriptor) Create new Meter metric without labels.newMeter
(MetricDescriptor descriptor, String labelName) Create new Meter metric with 1 label.newMeter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Create new Meter metric with 2 labels.newMeter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName) Create new Meter metric with 3 labels.newMeter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName) Create new Meter metric with 4 labels.newMeter
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName, String fifthLabelName) Create new Meter metric with 5 labels.Deprecated, for removal: This API element is subject to removal in a future version.newTimer
(MetricDescriptor descriptor) Create new Timer metric without labels.newTimer
(MetricDescriptor descriptor, String labelName) Create new Timer metric with 1 label.newTimer
(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Create new Timer metric with 2 labels.io.prometheus.client.CollectorRegistry
registry()
-
Constructor Details
-
PrometheusMetricProvider
@Inject public PrometheusMetricProvider()Constructor. We force passing an existing CollectorRegistry instead of CollectorRegistry.defaultRegistry because defaultRegistry is static, which is a problem for use e.g. in tests.
-
-
Method Details
-
close
@PreDestroy public void close()- Specified by:
close
in interfaceAutoCloseable
-
registry
public io.prometheus.client.CollectorRegistry registry() -
newMeter
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MetricProvider
Create new Meter metric.- Specified by:
newMeter
in interfaceMetricProvider
-
newMeter
Description copied from interface:MetricProvider
Create new Meter metric without labels.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
- Returns:
- the Meter
-
newMeter
Description copied from interface:MetricProvider
Create new Meter metric with 1 label.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
labelName
- name of the (only) label of this metric- Returns:
- an object from which a Meter can be obtained, given 1 label value
-
newMeter
public Labeled<Labeled<Meter>> newMeter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Description copied from interface:MetricProvider
Create new Meter metric with 2 labels.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metric- Returns:
- an object from which a Meter can be obtained, given 2 label values
-
newMeter
public Labeled<Labeled<Labeled<Meter>>> newMeter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName) Description copied from interface:MetricProvider
Create new Meter metric with 3 labels.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metric- Returns:
- an object from which a Meter can be obtained, given 3 label values
-
newMeter
public Labeled<Labeled<Labeled<Labeled<Meter>>>> newMeter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName) Description copied from interface:MetricProvider
Create new Meter metric with 4 labels.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metricfourthLabelName
- name of the 4th label of this metric- Returns:
- an object from which a Meter can be obtained, given 3 label values
-
newMeter
public Labeled<Labeled<Labeled<Labeled<Labeled<Meter>>>>> newMeter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName, String fifthLabelName) Description copied from interface:MetricProvider
Create new Meter metric with 5 labels.- Specified by:
newMeter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metricfourthLabelName
- name of the 4th label of this metricfifthLabelName
- name of the 5th label of this metric- Returns:
- an object from which a Meter can be obtained, given 3 label values
-
newCounter
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:MetricProvider
Create new Counter metric.- Specified by:
newCounter
in interfaceMetricProvider
-
newCounter
Description copied from interface:MetricProvider
Create new Counter metric without labels.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
- Returns:
- the Counter
-
newCounter
Description copied from interface:MetricProvider
Create new Counter metric with 1 label.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
labelName
- name of the (only) label of this metric- Returns:
- an object from which a Counter can be obtained, given 1 label value
-
newCounter
public Labeled<Labeled<Counter>> newCounter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Description copied from interface:MetricProvider
Create new Counter metric with 2 labels.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metric- Returns:
- an object from which a Counter can be obtained, given 2 label values
-
newCounter
public Labeled<Labeled<Labeled<Counter>>> newCounter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName) Description copied from interface:MetricProvider
Create new Counter metric with 3 labels.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metric- Returns:
- an object from which a Counter can be obtained, given 3 label values
-
newCounter
public Labeled<Labeled<Labeled<Labeled<Counter>>>> newCounter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName) Description copied from interface:MetricProvider
Create new Counter metric with 4 labels.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metricfourthLabelName
- name of the 4th label of this metric- Returns:
- an object from which a Counter can be obtained, given 4 label values
-
newCounter
public Labeled<Labeled<Labeled<Labeled<Labeled<Counter>>>>> newCounter(MetricDescriptor descriptor, String firstLabelName, String secondLabelName, String thirdLabelName, String fourthLabelName, String fifthLabelName) Description copied from interface:MetricProvider
Create new Counter metric with 5 labels.- Specified by:
newCounter
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metricthirdLabelName
- name of the 3rd label of this metricfourthLabelName
- name of the 4th label of this metricfifthLabelName
- name of the 5th label of this metric- Returns:
- an object from which a Counter can be obtained, given 5 label values
-
newTimer
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
newTimer
in interfaceMetricProvider
-
newTimer
Description copied from interface:MetricProvider
Create new Timer metric without labels.- Specified by:
newTimer
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
- Returns:
- the Timer
-
newTimer
Description copied from interface:MetricProvider
Create new Timer metric with 1 label.- Specified by:
newTimer
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
labelName
- name of the (only) label of this metric- Returns:
- an object from which a Timer can be obtained, given 1 label value
-
newTimer
public Labeled<Labeled<Timer>> newTimer(MetricDescriptor descriptor, String firstLabelName, String secondLabelName) Description copied from interface:MetricProvider
Create new Timer metric with 2 labels.- Specified by:
newTimer
in interfaceMetricProvider
- Parameters:
descriptor
- a MetricDescriptor, typically created viaMetricDescriptor.builder().anchor(this) .project("<projectName>").module("<moduleName>").id("<metricName>").build()
firstLabelName
- name of the 1st label of this metricsecondLabelName
- name of the 2nd label of this metric- Returns:
- an object from which a Timer can be obtained, given 2 label values
-