Class OpenMetrics2TextFormatWriter
Object
OpenMetrics2TextFormatWriter
- All Implemented Interfaces:
ExpositionFormatWriter
Write the OpenMetrics 2.0 text format. Unlike the OM1 writer, this writer outputs metric names as
provided by the user — no
_total or unit suffix appending. The _info suffix is
enforced per the OM2 spec (MUST). This is experimental and subject to change as the OpenMetrics
2.0 specification evolves.-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOpenMetrics2TextFormatWriter(OpenMetrics2Properties openMetrics2Properties, boolean createdTimestampsEnabled, boolean exemplarsOnAllMetricTypesEnabled) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuilder()static OpenMetrics2TextFormatWritercreate()voidwrite(OutputStream out, MetricSnapshots metricSnapshots, EscapingScheme scheme) Writes the given metric snapshots to the output stream using the specified escaping scheme.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ExpositionFormatWriter
isAvailable, toDebugString, toDebugString, write
-
Field Details
-
CONTENT_TYPE
- See Also:
-
-
Constructor Details
-
OpenMetrics2TextFormatWriter
public OpenMetrics2TextFormatWriter(OpenMetrics2Properties openMetrics2Properties, boolean createdTimestampsEnabled, boolean exemplarsOnAllMetricTypesEnabled) - Parameters:
openMetrics2Properties- OpenMetrics 2.0 feature flagscreatedTimestampsEnabled- whether to include the _created timestamp in the output - This will produce an invalid OpenMetrics output, but is kept for backwards compatibility.exemplarsOnAllMetricTypesEnabled- whether to include exemplars on all metric types
-
-
Method Details
-
builder
-
create
-
accepts
- Specified by:
acceptsin interfaceExpositionFormatWriter
-
getContentType
- Specified by:
getContentTypein interfaceExpositionFormatWriter
-
getOpenMetrics2Properties
-
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
-