Class BaseMetricCollector<T,​I extends io.prometheus.client.SimpleCollector<?>>

    • Field Detail

      • labelNames

        protected final String[] labelNames
      • namespace

        protected final String namespace
      • subsystem

        protected final String subsystem
      • namePrefix

        protected final String namePrefix
      • collector

        protected final I extends io.prometheus.client.SimpleCollector<?> collector
    • Constructor Detail

      • BaseMetricCollector

        protected BaseMetricCollector​(String[] labelNames,
                                      String namespace,
                                      String subsystem,
                                      String namePrefix)
      • BaseMetricCollector

        protected BaseMetricCollector​(String[] labelNames,
                                      String namespace,
                                      String subsystem)
    • Method Detail

      • getCollectorType

        protected abstract CollectorType getCollectorType()
        Returns:
        - the name of the collector without subsystem, namespace, prefix
      • getHelpText

        protected abstract String getHelpText()
        Returns:
        - the help text which should be displayed
      • getCollectorBuilder

        protected abstract io.prometheus.client.SimpleCollector.Builder<?,​I> getCollectorBuilder()
        Returns:
        - builder object of the type of collector
      • initCollector

        protected I initCollector()
      • collect

        public List<io.prometheus.client.Collector.MetricFamilySamples> collect()
        Description copied from interface: MetricCollector
        Calling this method basically calls I.collect()
        Specified by:
        collect in interface MetricCollector<T,​I extends io.prometheus.client.SimpleCollector<?>>
      • calculateName

        public String 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 interface MetricCollector<T,​I extends io.prometheus.client.SimpleCollector<?>>
        Returns:
        the full name of the collector
      • getBaseName

        protected String getBaseName()
      • calculateMetric

        public abstract void calculateMetric​(T jenkinsObject,
                                             String[] labelValues)
        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 interface MetricCollector<T,​I extends io.prometheus.client.SimpleCollector<?>>
        Parameters:
        jenkinsObject - - Examples: Job, Run
        labelValues - - The label values for the calculation