Package org.mockserver.metrics
Class JvmMetricsCollector
java.lang.Object
org.mockserver.metrics.JvmMetricsCollector
- All Implemented Interfaces:
io.prometheus.metrics.model.registry.MultiCollector
public class JvmMetricsCollector
extends Object
implements io.prometheus.metrics.model.registry.MultiCollector
Exposes JVM runtime metrics (heap / non-heap memory, threads, GC) as
Prometheus gauges so the dashboard Metrics view and Grafana can chart
MockServer's process health. Registered once alongside
BuildInfoCollector when metrics are enabled.
Reads only JDK java.lang.management MX beans — no extra dependency —
and is read-only/allocation-light, so scraping it has negligible overhead.
Values are sampled fresh on each collect() (i.e. each scrape).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.prometheus.metrics.model.snapshots.MetricSnapshotscollect()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.prometheus.metrics.model.registry.MultiCollector
collect, collect, collect, getLabelNames, getMetadata, getMetricFamilyDescriptors, getMetricType
-
Constructor Details
-
JvmMetricsCollector
public JvmMetricsCollector()
-
-
Method Details
-
collect
public io.prometheus.metrics.model.snapshots.MetricSnapshots collect()- Specified by:
collectin interfaceio.prometheus.metrics.model.registry.MultiCollector
-
getPrometheusNames
- Specified by:
getPrometheusNamesin interfaceio.prometheus.metrics.model.registry.MultiCollector
-