Class BaseMetricCollector<T,I extends io.prometheus.client.SimpleCollector<?>>
java.lang.Object
org.jenkinsci.plugins.prometheus.collectors.BaseMetricCollector<T,I>
- All Implemented Interfaces:
MetricCollector<T,
I>
- Direct Known Subclasses:
BuildsMetricCollector
,DiskUsageBytesGauge
,DiskUsageFileCountGauge
,ExecutorsAvailableGauge
,ExecutorsBusyGauge
,ExecutorsConnectingGauge
,ExecutorsDefinedGauge
,ExecutorsIdleGauge
,ExecutorsOnlineGauge
,ExecutorsQueueLengthGauge
,FileStoreAvailableGauge
,FileStoreCapacityGauge
,JenkinsQuietDownGauge
,JenkinsUpGauge
,JenkinsUptimeGauge
,JenkinsVersionInfo
,JobUsageBytesGauge
,NodesOnlineGauge
public abstract class BaseMetricCollector<T,I extends io.prometheus.client.SimpleCollector<?>>
extends Object
implements MetricCollector<T,I>
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseMetricCollector
(String[] labelNames, String namespace, String subsystem) protected
BaseMetricCollector
(String[] labelNames, String namespace, String subsystem, String namePrefix) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
calculateMetric
(T jenkinsObject, String[] labelValues) This method contains the logic to calculate a metric value based on the given Jenkins object (e.g.Calling this method will return the resulting name of the metric with base name and prefixList<io.prometheus.client.Collector.MetricFamilySamples>
collect()
Calling this method basically calls I.collect()protected String
protected abstract io.prometheus.client.SimpleCollector.Builder<?,
I> protected abstract CollectorType
protected abstract String
protected I
-
Field Details
-
SEPARATOR
- See Also:
-
labelNames
-
namespace
-
subsystem
-
namePrefix
-
collector
-
-
Constructor Details
-
BaseMetricCollector
-
BaseMetricCollector
-
-
Method Details
-
getCollectorType
- Returns:
- - the name of the collector without subsystem, namespace, prefix
-
getHelpText
- Returns:
- - the help text which should be displayed
-
getCollectorBuilder
- Returns:
- - builder object of the type of collector
-
initCollector
-
collect
Description copied from interface:MetricCollector
Calling this method basically calls I.collect()- Specified by:
collect
in interfaceMetricCollector<T,
I extends io.prometheus.client.SimpleCollector<?>>
-
calculateName
Description copied from interface:MetricCollector
Calling this method will return the resulting name of the metric with base name and prefix- Specified by:
calculateName
in interfaceMetricCollector<T,
I extends io.prometheus.client.SimpleCollector<?>> - Returns:
- the full name of the collector
-
getBaseName
-
calculateMetric
Description copied from interface:MetricCollector
This method contains the logic to calculate a metric value based on the given Jenkins object (e.g. Job, Run,...)- Specified by:
calculateMetric
in interfaceMetricCollector<T,
I extends io.prometheus.client.SimpleCollector<?>> - Parameters:
jenkinsObject
- - Examples:Job
,Run
labelValues
- - The label values for the calculation
-