Class PrometheusMetricDataParser<T>

  • Type Parameters:
    T - the metric family object type that the parser produces
    Direct Known Subclasses:
    TextPrometheusMetricDataParser

    public abstract class PrometheusMetricDataParser<T>
    extends java.lang.Object
    An object that can parse Prometheus found in a specific data format in an input stream. The type is the metric family object for the specific data format. It is the job of the associated PrometheusMetricsProcessor to process the parsed data.
    • Constructor Summary

      Constructors 
      Constructor Description
      PrometheusMetricDataParser​(java.io.InputStream inputStream)
      Provides the input stream where the parser will look for metric data.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.io.InputStream getInputStream()  
      abstract T parse()
      Reads a single metric family from the Prometheus metric data stream and returns it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PrometheusMetricDataParser

        public PrometheusMetricDataParser​(java.io.InputStream inputStream)
        Provides the input stream where the parser will look for metric data. NOTE: this object will not own this stream - it should never attempt to close it.
        Parameters:
        inputStream - the stream where the metric data can be found
    • Method Detail

      • getInputStream

        protected java.io.InputStream getInputStream()
      • parse

        public abstract T parse()
                         throws java.io.IOException
        Reads a single metric family from the Prometheus metric data stream and returns it. Returns null when no more data is in the stream. This method is designed to be called several times, each time it returns the next metric family found in the input stream.
        Returns:
        the metric family data found in the stream, or null
        Throws:
        java.io.IOException - if failed to read the data from the stream