All Implemented Interfaces:
Collector

public class Info extends MetricWithFixedMetadata
Info metric. Example:

 Info info = Info.builder()
         .name("java_runtime_info")
         .help("Java runtime info")
         .labelNames("env", "version", "vendor", "runtime")
         .register();

 String version = System.getProperty("java.runtime.version", "unknown");
 String vendor = System.getProperty("java.vm.vendor", "unknown");
 String runtime = System.getProperty("java.runtime.name", "unknown");

 info.addLabelValues("prod", version, vendor, runtime);
 info.addLabelValues("dev", version, vendor, runtime);
 
  • Method Details

    • setLabelValues

      public void setLabelValues(String... labelValues)
      Set the info label values. This will replace any previous values, i.e. the info metric will only have one data point after calling setLabelValues(). This is good for a metric like target_info where you want only one single data point.
    • addLabelValues

      public void addLabelValues(String... labelValues)
      Create an info data point with the given label values.
    • remove

      public void remove(String... labelValues)
      Remove the data point with the specified label values.
    • collect

      public InfoSnapshot collect()
      Specified by:
      collect in interface Collector
      Specified by:
      collect in class Metric
    • builder

      public static Info.Builder builder()
    • builder

      public static Info.Builder builder(PrometheusProperties config)