Class TextFormat
java.lang.Object
io.prometheus.client.exporter.common.TextFormat
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
chooseContentType
(String acceptHeader) Return the content type that should be used for a given Accept HTTP header.private static String
(package private) static void
omWriteTimestamp
(Writer writer, long timestampMs) private static String
static void
write004
(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) Write out the text version 0.0.4 of the given MetricFamilySamples.private static void
writeEscapedHelp
(Writer writer, String s) private static void
writeEscapedLabelValue
(Writer writer, String s) static void
writeFormat
(String contentType, Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) Write out the given MetricFamilySamples in a format per the contentType.static void
writeOpenMetrics100
(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) Write out the OpenMetrics text version 1.0.0 of the given MetricFamilySamples.
-
Field Details
-
CONTENT_TYPE_004
Content-type for Prometheus text version 0.0.4.- See Also:
-
CONTENT_TYPE_OPENMETRICS_100
Content-type for Openmetrics text version 1.0.0.- Since:
- 0.10.0
- See Also:
-
-
Constructor Details
-
TextFormat
public TextFormat()
-
-
Method Details
-
chooseContentType
Return the content type that should be used for a given Accept HTTP header.- Since:
- 0.10.0
-
writeFormat
public static void writeFormat(String contentType, Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException Write out the given MetricFamilySamples in a format per the contentType.- Throws:
IOException
- Since:
- 0.10.0
-
write004
public static void write004(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException Write out the text version 0.0.4 of the given MetricFamilySamples.- Throws:
IOException
-
writeEscapedHelp
- Throws:
IOException
-
writeEscapedLabelValue
- Throws:
IOException
-
typeString
-
writeOpenMetrics100
public static void writeOpenMetrics100(Writer writer, Enumeration<Collector.MetricFamilySamples> mfs) throws IOException Write out the OpenMetrics text version 1.0.0 of the given MetricFamilySamples.- Throws:
IOException
- Since:
- 0.10.0
-
omWriteTimestamp
- Throws:
IOException
-
omTypeString
-