java.lang.Object
io.prometheus.metrics.expositionformats.TextFormatUtil

public class TextFormatUtil extends Object
Utility methods for writing Prometheus text exposition formats.

This class provides low-level formatting utilities used by both Prometheus text format and OpenMetrics format writers. It handles escaping, label formatting, timestamp conversion, and merging of duplicate metric names.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.prometheus.metrics.model.snapshots.MetricSnapshots
    mergeDuplicates(io.prometheus.metrics.model.snapshots.MetricSnapshots metricSnapshots)
    Merges snapshots with duplicate Prometheus names by combining their data points.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TextFormatUtil

      public TextFormatUtil()
  • Method Details

    • mergeDuplicates

      public static io.prometheus.metrics.model.snapshots.MetricSnapshots mergeDuplicates(io.prometheus.metrics.model.snapshots.MetricSnapshots metricSnapshots)
      Merges snapshots with duplicate Prometheus names by combining their data points. This ensures only one HELP/TYPE declaration per metric family.