Class PrometheusTextFormatWriter
java.lang.Object
io.prometheus.metrics.expositionformats.PrometheusTextFormatWriter
- All Implemented Interfaces:
ExpositionFormatWriter
Write the Prometheus text format. This is the default if you view a Prometheus endpoint with your
Web browser.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionPrometheusTextFormatWriter(boolean writeCreatedTimestamps) Deprecated.privatePrometheusTextFormatWriter(boolean writeCreatedTimestamps, boolean timestampsInMs) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuilder()static PrometheusTextFormatWritercreate()private ClassicHistogramBucketsvoidwrite(OutputStream out, MetricSnapshots metricSnapshots, EscapingScheme scheme) Writes the given metric snapshots to the output stream using the specified escaping scheme.private voidwriteCounter(Writer writer, CounterSnapshot snapshot, EscapingScheme scheme) voidwriteCreated(Writer writer, MetricSnapshot snapshot, EscapingScheme scheme) private voidwriteEscapedHelp(Writer writer, String s) private voidwriteGauge(Writer writer, GaugeSnapshot snapshot, EscapingScheme scheme) private voidwriteGaugeCountSum(Writer writer, HistogramSnapshot snapshot, MetricMetadata metadata, EscapingScheme scheme) private voidwriteHistogram(Writer writer, HistogramSnapshot snapshot, EscapingScheme scheme) private voidwriteInfo(Writer writer, InfoSnapshot snapshot, EscapingScheme scheme) private voidwriteMetadata(Writer writer, String suffix, String typeString, MetricMetadata metadata, EscapingScheme scheme) private voidwriteNameAndLabels(Writer writer, String name, String suffix, Labels labels, EscapingScheme escapingScheme) private voidwriteNameAndLabels(Writer writer, String name, String suffix, Labels labels, EscapingScheme scheme, String additionalLabelName, double additionalLabelValue) private voidwriteScrapeTimestampAndNewline(Writer writer, DataPointSnapshot data) private voidwriteStateSet(Writer writer, StateSetSnapshot snapshot, EscapingScheme scheme) private voidwriteSummary(Writer writer, SummarySnapshot snapshot, EscapingScheme scheme) private voidwriteUnknown(Writer writer, UnknownSnapshot snapshot, EscapingScheme scheme) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ExpositionFormatWriter
isAvailable, toDebugString, toDebugString, write
-
Field Details
-
CONTENT_TYPE
- See Also:
-
writeCreatedTimestamps
private final boolean writeCreatedTimestamps -
timestampsInMs
private final boolean timestampsInMs
-
-
Constructor Details
-
PrometheusTextFormatWriter
Deprecated.- Parameters:
writeCreatedTimestamps- whether to include the _created timestamp in the output - This will produce an invalid OpenMetrics output, but is kept for backwards compatibility.
-
PrometheusTextFormatWriter
private PrometheusTextFormatWriter(boolean writeCreatedTimestamps, boolean timestampsInMs)
-
-
Method Details
-
builder
-
create
-
accepts
- Specified by:
acceptsin interfaceExpositionFormatWriter
-
getContentType
- Specified by:
getContentTypein interfaceExpositionFormatWriter
-
write
public void write(OutputStream out, MetricSnapshots metricSnapshots, EscapingScheme scheme) throws IOException Description copied from interface:ExpositionFormatWriterWrites the given metric snapshots to the output stream using the specified escaping scheme.- Specified by:
writein interfaceExpositionFormatWriter- Throws:
IOException
-
writeCreated
public void writeCreated(Writer writer, MetricSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeCounter
private void writeCounter(Writer writer, CounterSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeGauge
private void writeGauge(Writer writer, GaugeSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeHistogram
private void writeHistogram(Writer writer, HistogramSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
getClassicBuckets
private ClassicHistogramBuckets getClassicBuckets(HistogramSnapshot.HistogramDataPointSnapshot data) -
writeGaugeCountSum
private void writeGaugeCountSum(Writer writer, HistogramSnapshot snapshot, MetricMetadata metadata, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeSummary
private void writeSummary(Writer writer, SummarySnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeInfo
private void writeInfo(Writer writer, InfoSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeStateSet
private void writeStateSet(Writer writer, StateSetSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeUnknown
private void writeUnknown(Writer writer, UnknownSnapshot snapshot, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeNameAndLabels
private void writeNameAndLabels(Writer writer, String name, String suffix, Labels labels, EscapingScheme escapingScheme) throws IOException - Throws:
IOException
-
writeNameAndLabels
private void writeNameAndLabels(Writer writer, String name, String suffix, Labels labels, EscapingScheme scheme, String additionalLabelName, double additionalLabelValue) throws IOException - Throws:
IOException
-
writeMetadata
private void writeMetadata(Writer writer, String suffix, String typeString, MetricMetadata metadata, EscapingScheme scheme) throws IOException - Throws:
IOException
-
writeEscapedHelp
- Throws:
IOException
-
writeScrapeTimestampAndNewline
private void writeScrapeTimestampAndNewline(Writer writer, DataPointSnapshot data) throws IOException - Throws:
IOException
-
builder()orcreate()instead