Package org.hawkular.agent.prometheus
Class PrometheusMetricDataParser<T>
- java.lang.Object
-
- org.hawkular.agent.prometheus.PrometheusMetricDataParser<T>
-
- Type Parameters:
T
- the metric family object type that the parser produces
- Direct Known Subclasses:
TextPrometheusMetricDataParser
public abstract class PrometheusMetricDataParser<T> extends Object
An object that can parse Prometheus found in a specific data format in an input stream. The typeis 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(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 InputStream
getInputStream()
abstract T
parse()
Reads a single metric family from the Prometheus metric data stream and returns it.
-
-
-
Constructor Detail
-
PrometheusMetricDataParser
public PrometheusMetricDataParser(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 InputStream getInputStream()
-
parse
public abstract T parse() throws 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:
IOException
- if failed to read the data from the stream
-
-