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_151-b12",vendor="Oracle Corporation",runtime="OpenJDK Runtime Environment",} 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", "runtime")); jvmInfo.addMetric( Arrays.asList( System.getProperty("java.runtime.version", "unknown"), System.getProperty("java.vm.vendor", "unknown"), System.getProperty("java.runtime.name", "unknown")), 1L); mfs.add(jvmInfo); return mfs; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy