Class PrometheusMetricsProcessor<T>

  • Direct Known Subclasses:
    TextPrometheusMetricsProcessor

    public abstract class PrometheusMetricsProcessor<T>
    extends java.lang.Object
    A processor is responsible for iterating over a collection of metric families found in a specific data format and invoking a walker during the iteration so the metric families can be processed.
    • Constructor Detail

      • PrometheusMetricsProcessor

        public PrometheusMetricsProcessor​(java.io.InputStream inputStream,
                                          PrometheusMetricsWalker theWalker)
        Parameters:
        inputStream - where the Prometheus metrics are that the walker will traverse.
        theWalker - the actual object that will be notified about the metrics as they are encountered
    • Method Detail

      • walk

        public void walk()
        This will iterate over a set of metrics that are produced by the parser and will notify the walker of each metric found.
      • getInputStream

        protected java.io.InputStream getInputStream()
        Returns:
        the input stream where the metric family data in a specific data format is found
      • getWalker

        protected PrometheusMetricsWalker getWalker()
        Returns:
        the object that will iterate over the found metric data
      • createPrometheusMetricDataParser

        protected abstract PrometheusMetricDataParser<T> createPrometheusMetricDataParser()
        Returns:
        a new parser instance that can be used to parse the formatted data found in the input stream.
      • convert

        protected abstract MetricFamily convert​(T metricFamily)
        This method converts the metrics from the specific data format found in the input stream to the common metric format.
        Parameters:
        metricFamily - the metric family (and its metrics) that need to be converted
        Returns:
        the common MetricFamily object