Class TextFormat
- java.lang.Object
-
- io.prometheus.client.exporter.common.TextFormat
-
public class TextFormat extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTENT_TYPE_004Content-type for Prometheus text version 0.0.4.static java.lang.StringCONTENT_TYPE_OPENMETRICS_100Content-type for Openmetrics text version 1.0.0.
-
Constructor Summary
Constructors Constructor Description TextFormat()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringchooseContentType(java.lang.String acceptHeader)Return the content type that should be used for a given Accept HTTP header.private static java.lang.StringomTypeString(Collector.Type t)(package private) static voidomWriteTimestamp(java.io.Writer writer, long timestampMs)private static java.lang.StringtypeString(Collector.Type t)static voidwrite004(java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs)Write out the text version 0.0.4 of the given MetricFamilySamples.private static voidwriteEscapedHelp(java.io.Writer writer, java.lang.String s)private static voidwriteEscapedLabelValue(java.io.Writer writer, java.lang.String s)static voidwriteFormat(java.lang.String contentType, java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs)Write out the given MetricFamilySamples in a format per the contentType.static voidwriteOpenMetrics100(java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs)Write out the OpenMetrics text version 1.0.0 of the given MetricFamilySamples.
-
-
-
Field Detail
-
CONTENT_TYPE_004
public static final java.lang.String CONTENT_TYPE_004
Content-type for Prometheus text version 0.0.4.- See Also:
- Constant Field Values
-
CONTENT_TYPE_OPENMETRICS_100
public static final java.lang.String CONTENT_TYPE_OPENMETRICS_100
Content-type for Openmetrics text version 1.0.0.- Since:
- 0.10.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
chooseContentType
public static java.lang.String chooseContentType(java.lang.String acceptHeader)
Return the content type that should be used for a given Accept HTTP header.- Since:
- 0.10.0
-
writeFormat
public static void writeFormat(java.lang.String contentType, java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs) throws java.io.IOExceptionWrite out the given MetricFamilySamples in a format per the contentType.- Throws:
java.io.IOException- Since:
- 0.10.0
-
write004
public static void write004(java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs) throws java.io.IOExceptionWrite out the text version 0.0.4 of the given MetricFamilySamples.- Throws:
java.io.IOException
-
writeEscapedHelp
private static void writeEscapedHelp(java.io.Writer writer, java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
writeEscapedLabelValue
private static void writeEscapedLabelValue(java.io.Writer writer, java.lang.String s) throws java.io.IOException- Throws:
java.io.IOException
-
typeString
private static java.lang.String typeString(Collector.Type t)
-
writeOpenMetrics100
public static void writeOpenMetrics100(java.io.Writer writer, java.util.Enumeration<Collector.MetricFamilySamples> mfs) throws java.io.IOExceptionWrite out the OpenMetrics text version 1.0.0 of the given MetricFamilySamples.- Throws:
java.io.IOException- Since:
- 0.10.0
-
omWriteTimestamp
static void omWriteTimestamp(java.io.Writer writer, long timestampMs) throws java.io.IOException- Throws:
java.io.IOException
-
omTypeString
private static java.lang.String omTypeString(Collector.Type t)
-
-