All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.prometheus.client.hotspot.VersionInfoExports Maven / Gradle / Ivy

package io.prometheus.client.hotspot;

import io.prometheus.client.Collector;
import io.prometheus.client.GaugeMetricFamily;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Exports JVM version info.
 * 

* Example usage: *

 * {@code
 *   new VersionInfoExports().register();
 * }
 * 
* Metrics being exported: *
 *   jvm_info{version="1.8.0_45-b14",vendor="Oracle Corporation"} 1.0
 * 
*/ public class VersionInfoExports extends Collector { public List collect() { List mfs = new ArrayList(); GaugeMetricFamily jvmInfo = new GaugeMetricFamily( "jvm_info", "JVM version info", Arrays.asList("version", "vendor")); jvmInfo.addMetric(Arrays.asList(System.getProperty("java.runtime.version", "unknown"), System.getProperty("java.vm.vendor", "unknown")), 1L); mfs.add(jvmInfo); return mfs; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy