Class OpenMetrics2TextFormatWriter

java.lang.Object
io.prometheus.metrics.expositionformats.OpenMetrics2TextFormatWriter
All Implemented Interfaces:
ExpositionFormatWriter

@StableApi public class OpenMetrics2TextFormatWriter extends Object implements ExpositionFormatWriter
Write the OpenMetrics 2.0 text format. Unlike the OM1 writer, this writer outputs metric names as provided by the user, without appending _total or unit suffixes. The _info suffix is enforced per the OM2 spec (MUST). This is experimental and subject to change as the OpenMetrics 2.0 specification evolves.
  • Field Details

  • Constructor Details

    • OpenMetrics2TextFormatWriter

      public OpenMetrics2TextFormatWriter(io.prometheus.metrics.config.OpenMetrics2Properties openMetrics2Properties, boolean createdTimestampsEnabled, boolean exemplarsOnAllMetricTypesEnabled)
      Parameters:
      openMetrics2Properties - OpenMetrics 2.0 feature flags
      createdTimestampsEnabled - whether delegated OM1 output includes _created metrics
      exemplarsOnAllMetricTypesEnabled - whether to include exemplars on all metric types
  • Method Details