### Build and Start HTTPServer Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/httpserver/HTTPServer.Builder.html Initializes the server with the configured settings and starts the underlying HTTP or HTTPS server. ```java public HTTPServer buildAndStart() throws IOException { if (registry == null) { registry = PrometheusRegistry.defaultRegistry; } HttpServer httpServer; if (httpsConfigurator != null) { httpServer = HttpsServer.create(makeInetSocketAddress(), 3); ((HttpsServer) httpServer).setHttpsConfigurator(httpsConfigurator); } else { httpServer = HttpServer.create(makeInetSocketAddress(), 3); } ExecutorService executorService = makeExecutorService(); httpServer.setExecutor(executorService); return new HTTPServer( config, executorService, httpServer, registry, authenticator, authenticatedSubjectAttributeName, defaultHandler, metricsHandlerPath, registerHealthHandler); } ``` -------------------------------- ### Initialize and start HTTPServer Source: https://prometheus.github.io/client_java/exporters/httpserver Creates and starts a standalone server instance on a specified port. ```java HTTPServer server = HTTPServer.builder() .port(9400) .buildAndStart(); ``` -------------------------------- ### buildAndStart() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html Builds and starts the exporter. ```APIDOC ## buildAndStart() ### Description Finalizes the configuration and starts the OpenTelemetry exporter. ### Signature `public OpenTelemetryExporter buildAndStart()` ``` -------------------------------- ### Generic Cache Metrics Example Source: https://prometheus.github.io/client_java/instrumentation/caffeine Example output for standard cache metrics available for all instances. ```text # TYPE caffeine_cache_hit counter # HELP caffeine_cache_hit Cache hit totals caffeine_cache_hit_total{cache="mycache"} 10.0 # TYPE caffeine_cache_miss counter # HELP caffeine_cache_miss Cache miss totals caffeine_cache_miss_total{cache="mycache"} 3.0 # TYPE caffeine_cache_requests counter # HELP caffeine_cache_requests Cache request totals, hits + misses caffeine_cache_requests_total{cache="mycache"} 13.0 # TYPE caffeine_cache_eviction counter # HELP caffeine_cache_eviction Cache eviction totals, doesn't include manually removed entries caffeine_cache_eviction_total{cache="mycache"} 1.0 # TYPE caffeine_cache_estimated_size # HELP caffeine_cache_estimated_size Estimated cache size caffeine_cache_estimated_size{cache="mycache"} 5.0 ``` -------------------------------- ### Start an HTTPServer Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/exporter/httpserver/HTTPServer.html Initialize and start a new HTTPServer instance on a specified port using the builder pattern. ```java HTTPServer server = HTTPServer.builder() .port(9090) .buildAndStart(); ``` -------------------------------- ### HTTPServer Initialization Source: https://prometheus.github.io/client_java/exporters/httpserver How to instantiate and start the HTTPServer using the builder pattern. ```APIDOC ## HTTPServer Initialization ### Description Initializes and starts a standalone HTTPServer instance to expose metrics. ### Usage ```java HTTPServer server = HTTPServer.builder() .port(9400) .buildAndStart(); ``` ``` -------------------------------- ### buildAndStart() Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html Constructs and starts the OpenTelemetryExporter instance. ```APIDOC ## buildAndStart() ### Description Finalizes the configuration and returns a started OpenTelemetryExporter instance. ``` -------------------------------- ### HTTPServer.builder() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/exporter/httpserver/HTTPServer.html Creates a new builder instance to configure and start the HTTPServer. ```APIDOC ## static HTTPServer.Builder builder() ### Description Creates a new builder instance for configuring the HTTPServer. ### Signature `public static HTTPServer.Builder builder()` ``` -------------------------------- ### Example Exported Metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmCompilationMetrics.html Sample output format for the jvm_compilation_time_seconds_total metric. ```text # HELP jvm_compilation_time_seconds_total The total time in seconds taken for HotSpot class compilation # TYPE jvm_compilation_time_seconds_total counter jvm_compilation_time_seconds_total 0.152 ``` -------------------------------- ### Initialize Info Metric Builder Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/core/metrics/Info.Builder.html Shows the start of an Info metric builder initialization. ```java Info info1 = Info.builder() ``` -------------------------------- ### Loading Cache Metrics Example Source: https://prometheus.github.io/client_java/instrumentation/caffeine Metrics available specifically for LoadingCache instances. ```text # TYPE caffeine_cache_load_failure counter # HELP caffeine_cache_load_failure Cache load failures caffeine_cache_load_failure_total{cache="mycache"} 10.0 # TYPE caffeine_cache_loads counter # HELP caffeine_cache_loads Cache loads: both success and failures caffeine_cache_loads_total{cache="mycache"} 3.0 # TYPE caffeine_cache_load_duration_seconds summary # HELP caffeine_cache_load_duration_seconds Cache load duration: both success and failures caffeine_cache_load_duration_seconds_count{cache="mycache"} 7.0 caffeine_cache_load_duration_seconds_sum{cache="mycache"} 0.0034 ``` -------------------------------- ### Example Exported Metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmGarbageCollectorMetrics.html Sample output format for JVM garbage collection metrics. ```text # HELP jvm_gc_collection_seconds Time spent in a given JVM garbage collector in seconds. # TYPE jvm_gc_collection_seconds summary jvm_gc_collection_seconds_count{gc="PS MarkSweep"} 0 jvm_gc_collection_seconds_sum{gc="PS MarkSweep"} 0.0 jvm_gc_collection_seconds_count{gc="PS Scavenge"} 0 jvm_gc_collection_seconds_sum{gc="PS Scavenge"} 0.0 ``` -------------------------------- ### Example Exported Metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/ProcessMetrics.html Sample output format for process metrics exported by the library. ```text # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter process_cpu_seconds_total 1.63 # HELP process_max_fds Maximum number of open file descriptors. # TYPE process_max_fds gauge process_max_fds 524288.0 # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge process_open_fds 28.0 # HELP process_resident_memory_bytes Resident memory size in bytes. # TYPE process_resident_memory_bytes gauge process_resident_memory_bytes 7.8577664E7 # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. # TYPE process_start_time_seconds gauge process_start_time_seconds 1.693829439767E9 # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge process_virtual_memory_bytes 1.2683624448E10 ``` -------------------------------- ### Example exported metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryPoolAllocationMetrics.html Sample output of the jvm_memory_pool_allocated_bytes_total counter metrics. ```text # HELP jvm_memory_pool_allocated_bytes_total Total bytes allocated in a given JVM memory pool. Only updated after GC, not continuously. # TYPE jvm_memory_pool_allocated_bytes_total counter jvm_memory_pool_allocated_bytes_total{pool="Code Cache"} 4336448.0 jvm_memory_pool_allocated_bytes_total{pool="Compressed Class Space"} 875016.0 jvm_memory_pool_allocated_bytes_total{pool="Metaspace"} 7480456.0 jvm_memory_pool_allocated_bytes_total{pool="PS Eden Space"} 1.79232824E8 jvm_memory_pool_allocated_bytes_total{pool="PS Old Gen"} 1428888.0 jvm_memory_pool_allocated_bytes_total{pool="PS Survivor Space"} 4115280.0 ``` -------------------------------- ### Histogram Usage Example Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/metrics/Histogram.html Demonstrates how to build, register, and observe values with a Histogram metric. ```java Histogram histogram = Histogram.builder() .name("http_request_duration_seconds") .help("HTTP request service time in seconds") .unit(SECONDS) .labelNames("method", "path", "status_code") .register(); long start = System.nanoTime(); // do something histogram.labelValues("GET", "/", "200").observe(Unit.nanosToSeconds(System.nanoTime() - start)); ``` -------------------------------- ### Exposition format for initialized metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/metrics/StatefulMetric.html Shows the expected output when metrics are initialized with a zero value at application start. ```text payment_transactions_total{payment_type="credit card"} 0.0 payment_transactions_total{payment_type="paypal"} 0.0 ``` -------------------------------- ### nameMustStartWith(Collection prefixes) Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/model/registry/MetricNameFilter.Builder.html Includes only samples whose names start with one of the provided prefixes. ```APIDOC ### Method `public Builder nameMustStartWith(@Nullable Collection prefixes)` ### Description Restricts inclusion to samples starting with one of the specified prefixes. Empty input means no restriction is applied. ``` -------------------------------- ### Configure Summary Quantiles Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/core/metrics/Summary.html Examples for adding quantiles to a Summary metric, including standard usage and special cases for min/max values. ```java .quantile(0.95, 0.001) ``` ```java .quantile(0.0, 0.0) ``` ```java .quantile(1.0, 0.0) ``` -------------------------------- ### Build and Start Exporter Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/opentelemetry/OpenTelemetryExporter.Builder.html Initializes the OpenTelemetryExporter using the configured settings and the default registry if none is provided. ```java public OpenTelemetryExporter buildAndStart() { if (registry == null) { registry = PrometheusRegistry.defaultRegistry; } return new OpenTelemetryExporter(OtelAutoConfig.createReader(this, config, registry)); } ``` -------------------------------- ### Example Metric Output Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/guava/CacheMetricsCollector.html Shows the format of metrics exported for a monitored Guava cache. ```text guava_cache_hit_total{cache="mycache"} 10.0 guava_cache_miss_total{cache="mycache"} 3.0 guava_cache_requests_total{cache="mycache"} 13.0 guava_cache_eviction_total{cache="mycache"} 1.0 guava_cache_size{cache="mycache"} 5.0 ``` -------------------------------- ### Weighted Cache Metrics Example Source: https://prometheus.github.io/client_java/instrumentation/caffeine Metrics available for caches configured with a weigher. ```text # TYPE caffeine_cache_eviction_weight counter # HELP caffeine_cache_eviction_weight Weight of evicted cache entries, doesn't include manually removed entries caffeine_cache_eviction_weight_total{cache="mycache"} 5.0 # TYPE caffeine_cache_weighted_size gauge # HELP caffeine_cache_weighted_size Approximate accumulated weight of cache entries caffeine_cache_weighted_size{cache="mycache"} 30.0 ``` -------------------------------- ### Example Exported Metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmClassLoadingMetrics.html Sample output showing the gauge and counter metrics exported by the class. ```text # HELP jvm_classes_currently_loaded The number of classes that are currently loaded in the JVM # TYPE jvm_classes_currently_loaded gauge jvm_classes_currently_loaded 1109.0 # HELP jvm_classes_loaded_total The total number of classes that have been loaded since the JVM has started execution # TYPE jvm_classes_loaded_total counter jvm_classes_loaded_total 1109.0 # HELP jvm_classes_unloaded_total The total number of classes that have been unloaded since the JVM has started execution # TYPE jvm_classes_unloaded_total counter jvm_classes_unloaded_total 0.0 ``` -------------------------------- ### Configure HTTPServer Builder Options Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/httpserver/HTTPServer.Builder.html Methods for customizing the HTTPServer instance before it is built and started. ```java public Builder httpsConfigurator(HttpsConfigurator configurator) { this.httpsConfigurator = configurator; return this; } ``` ```java public Builder defaultHandler(HttpHandler defaultHandler) { this.defaultHandler = defaultHandler; return this; } ``` ```java public Builder metricsHandlerPath(String metricsHandlerPath) { this.metricsHandlerPath = metricsHandlerPath; return this; } ``` ```java public Builder registerHealthHandler(boolean registerHealthHandler) { this.registerHealthHandler = registerHealthHandler; return this; } ``` -------------------------------- ### Environment Variable to Property Mapping Source: https://prometheus.github.io/client_java/config/config Examples of mapping environment variables to their corresponding property names. ```text IO_PROMETHEUS_METRICS_EXEMPLARS_ENABLED -> io.prometheus.metrics.exemplars_enabled IO_PROMETHEUS_EXPORTER_HTTP_SERVER_PORT -> io.prometheus.exporter.http_server.port IO_PROMETHEUS_METRICS_HISTOGRAM_NATIVE_ONLY -> io.prometheus.metrics.histogram_native_only ``` -------------------------------- ### Configure HTTP Server Port via Properties Source: https://prometheus.github.io/client_java/config/config Example of setting the HTTPServer port using a properties file format. ```properties io.prometheus.exporter.http_server.port=9401 ``` -------------------------------- ### Initialize MetricsProperties Builder Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/config/MetricsProperties.Builder.html Use the static builder method to start configuring metrics properties. ```java public static Builder builder() { return new Builder(); } ``` -------------------------------- ### Start Application with OpenTelemetry Agent Source: https://prometheus.github.io/client_java/otel/tracing Attach the OpenTelemetry Java agent to your application at startup to enable distributed tracing. ```bash java -javaagent:path/to/opentelemetry-javaagent.jar -jar myapp.jar ``` -------------------------------- ### Example Loader Metrics Output Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/caffeine/CacheMetricsCollector.html Additional metrics provided when the cache includes a loader. ```text caffeine_cache_load_failure_total{cache="mycache"} 2.0 caffeine_cache_loads_total{cache="mycache"} 7.0 caffeine_cache_load_duration_seconds_count{cache="mycache"} 7.0 caffeine_cache_load_duration_seconds_sum{cache="mycache"} 0.0034 ``` -------------------------------- ### Initialize Prometheus Java Application Source: https://prometheus.github.io/client_java/getting-started/quickstart Sets up JVM metrics, registers a custom counter, and starts an HTTP server on port 9400. ```java import io.prometheus.metrics.core.metrics.Counter; import io.prometheus.metrics.exporter.httpserver.HTTPServer; import io.prometheus.metrics.instrumentation.jvm.JvmMetrics; import java.io.IOException; public class App { public static void main(String[] args) throws InterruptedException, IOException { JvmMetrics.builder().register(); // initialize the out-of-the-box JVM metrics Counter counter = Counter.builder() .name("my_count_total") .help("example counter") .labelNames("status") .register(); counter.labelValues("ok").inc(); counter.labelValues("ok").inc(); counter.labelValues("error").inc(); HTTPServer server = HTTPServer.builder() .port(9400) .buildAndStart(); System.out.println("HTTPServer listening on port http://localhost:" + server.getPort() + "/metrics"); Thread.currentThread().join(); // sleep forever } } ``` -------------------------------- ### Example Exported Metrics Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetrics.html Sample output of JVM memory metrics exported in Prometheus format. ```text # HELP jvm_memory_committed_bytes Committed (bytes) of a given JVM memory area. # TYPE jvm_memory_committed_bytes gauge jvm_memory_committed_bytes{area="heap"} 4.98597888E8 jvm_memory_committed_bytes{area="nonheap"} 1.1993088E7 # HELP jvm_memory_init_bytes Initial bytes of a given JVM memory area. # TYPE jvm_memory_init_bytes gauge jvm_memory_init_bytes{area="heap"} 5.20093696E8 jvm_memory_init_bytes{area="nonheap"} 2555904.0 # HELP jvm_memory_max_bytes Max (bytes) of a given JVM memory area. # TYPE jvm_memory_max_bytes gauge jvm_memory_max_bytes{area="heap"} 7.38983936E9 jvm_memory_max_bytes{area="nonheap"} -1.0 # HELP jvm_memory_objects_pending_finalization The number of objects waiting in the finalizer queue. # TYPE jvm_memory_objects_pending_finalization gauge jvm_memory_objects_pending_finalization 0.0 # HELP jvm_memory_pool_collection_committed_bytes Committed after last collection bytes of a given JVM memory pool. # TYPE jvm_memory_pool_collection_committed_bytes gauge jvm_memory_pool_collection_committed_bytes{pool="PS Eden Space"} 1.30023424E8 jvm_memory_pool_collection_committed_bytes{pool="PS Old Gen"} 3.47078656E8 jvm_memory_pool_collection_committed_bytes{pool="PS Survivor Space"} 2.1495808E7 ``` -------------------------------- ### Implement a Batch Job with Pushgateway Source: https://prometheus.github.io/client_java/exporters/pushgateway Example of a batch job that registers a gauge and pushes metrics to the Pushgateway upon completion. ```java public class ExampleBatchJob { private static PushGateway pushGateway = PushGateway.builder() .address("localhost:9091") // not needed as localhost:9091 is the default .job("example") .build(); private static Gauge dataProcessedInBytes = Gauge.builder() .name("data_processed") .help("data processed in the last batch job run") .unit(Unit.BYTES) .register(); public static void main(String[] args) throws Exception { try { long bytesProcessed = processData(); dataProcessedInBytes.set(bytesProcessed); } finally { pushGateway.push(); } } public static long processData() { // Imagine a batch job here that processes data // and returns the number of Bytes processed. return 42; } } ``` -------------------------------- ### Example Metrics Output Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmNativeMemoryMetrics.html Sample output showing the exported gauge metrics for committed and reserved native memory. ```text # HELP jvm_native_memory_committed_bytes Committed bytes of a given JVM. Committed memory represents the amount of memory the JVM is using right now. # TYPE jvm_native_memory_committed_bytes gauge jvm_native_memory_committed_bytes{pool="Arena Chunk"} 58480.0 jvm_native_memory_committed_bytes{pool="Arguments"} 25119.0 jvm_native_memory_committed_bytes{pool="Class"} 1.00609438E8 jvm_native_memory_committed_bytes{pool="Code"} 2.7980888E7 jvm_native_memory_committed_bytes{pool="Compiler"} 529922.0 jvm_native_memory_committed_bytes{pool="GC"} 515466.0 jvm_native_memory_committed_bytes{pool="Internal"} 673194.0 jvm_native_memory_committed_bytes{pool="Java Heap"} 4.0923136E7 jvm_native_memory_committed_bytes{pool="Logging"} 4596.0 jvm_native_memory_committed_bytes{pool="Module"} 96408.0 jvm_native_memory_committed_bytes{pool="Native Memory Tracking"} 3929432.0 jvm_native_memory_committed_bytes{pool="Other"} 667656.0 jvm_native_memory_committed_bytes{pool="Safepoint"} 8192.0 jvm_native_memory_committed_bytes{pool="Symbol"} 2.4609808E7 jvm_native_memory_committed_bytes{pool="Synchronizer"} 272520.0 jvm_native_memory_committed_bytes{pool="Thread"} 3546896.0 jvm_native_memory_committed_bytes{pool="Total"} 2.0448392E8 jvm_native_memory_committed_bytes{pool="Tracing"} 1.0 jvm_native_memory_committed_bytes{pool="Unknown"} 32768.0 # HELP jvm_native_memory_reserved_bytes Reserved bytes of a given JVM. Reserved memory represents the total amount of memory the JVM can potentially use. # TYPE jvm_native_memory_reserved_bytes gauge jvm_native_memory_reserved_bytes{pool="Arena Chunk"} 25736.0 jvm_native_memory_reserved_bytes{pool="Arguments"} 25119.0 jvm_native_memory_reserved_bytes{pool="Class"} 1.162665374E9 jvm_native_memory_reserved_bytes{pool="Code"} 2.55386712E8 jvm_native_memory_reserved_bytes{pool="Compiler"} 529922.0 jvm_native_memory_reserved_bytes{pool="GC"} 1695114.0 jvm_native_memory_reserved_bytes{pool="Internal"} 673191.0 jvm_native_memory_reserved_bytes{pool="Java Heap"} 4.02653184E8 jvm_native_memory_reserved_bytes{pool="Logging"} 4596.0 jvm_native_memory_reserved_bytes{pool="Module"} 96408.0 jvm_native_memory_reserved_bytes{pool="Native Memory Tracking"} 3929400.0 jvm_native_memory_reserved_bytes{pool="Other"} 667656.0 jvm_native_memory_reserved_bytes{pool="Safepoint"} 8192.0 jvm_native_memory_reserved_bytes{pool="Symbol"} 2.4609808E7 jvm_native_memory_reserved_bytes{pool="Synchronizer"} 272520.0 jvm_native_memory_reserved_bytes{pool="Thread"} 3.383272E7 jvm_native_memory_reserved_bytes{pool="Total"} 1.887108421E9 jvm_native_memory_reserved_bytes{pool="Tracing"} 1.0 jvm_native_memory_reserved_bytes{pool="Unknown"} 32768.0 ``` -------------------------------- ### Example JVM Memory Metrics Output Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetrics.Builder.html Sample output showing various JVM memory metrics exported by the instrumentation. ```text # HELP jvm_memory_committed_bytes Committed (bytes) of a given JVM memory area. # TYPE jvm_memory_committed_bytes gauge jvm_memory_committed_bytes{area="heap"} 4.98597888E8 jvm_memory_committed_bytes{area="nonheap"} 1.1993088E7 # HELP jvm_memory_init_bytes Initial bytes of a given JVM memory area. # TYPE jvm_memory_init_bytes gauge jvm_memory_init_bytes{area="heap"} 5.20093696E8 jvm_memory_init_bytes{area="nonheap"} 2555904.0 # HELP jvm_memory_max_bytes Max (bytes) of a given JVM memory area. # TYPE jvm_memory_max_bytes gauge jvm_memory_max_bytes{area="heap"} 7.38983936E9 jvm_memory_max_bytes{area="nonheap"} -1.0 # HELP jvm_memory_objects_pending_finalization The number of objects waiting in the finalizer queue. # TYPE jvm_memory_objects_pending_finalization gauge jvm_memory_objects_pending_finalization 0.0 # HELP jvm_memory_pool_collection_committed_bytes Committed after last collection bytes of a given JVM memory pool. # TYPE jvm_memory_pool_collection_committed_bytes gauge jvm_memory_pool_collection_committed_bytes{pool="PS Eden Space"} 1.30023424E8 jvm_memory_pool_collection_committed_bytes{pool="PS Old Gen"} 3.47078656E8 jvm_memory_pool_collection_committed_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_collection_init_bytes Initial after last collection bytes of a given JVM memory pool. # TYPE jvm_memory_pool_collection_init_bytes gauge jvm_memory_pool_collection_init_bytes{pool="PS Eden Space"} 1.30023424E8 jvm_memory_pool_collection_init_bytes{pool="PS Old Gen"} 3.47078656E8 jvm_memory_pool_collection_init_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_collection_max_bytes Max bytes after last collection of a given JVM memory pool. # TYPE jvm_memory_pool_collection_max_bytes gauge jvm_memory_pool_collection_max_bytes{pool="PS Eden Space"} 2.727870464E9 jvm_memory_pool_collection_max_bytes{pool="PS Old Gen"} 5.542248448E9 jvm_memory_pool_collection_max_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_collection_used_bytes Used bytes after last collection of a given JVM memory pool. # TYPE jvm_memory_pool_collection_used_bytes gauge jvm_memory_pool_collection_used_bytes{pool="PS Eden Space"} 0.0 jvm_memory_pool_collection_used_bytes{pool="PS Old Gen"} 1249696.0 jvm_memory_pool_collection_used_bytes{pool="PS Survivor Space"} 0.0 # HELP jvm_memory_pool_committed_bytes Committed bytes of a given JVM memory pool. # TYPE jvm_memory_pool_committed_bytes gauge jvm_memory_pool_committed_bytes{pool="Code Cache"} 4128768.0 jvm_memory_pool_committed_bytes{pool="Compressed Class Space"} 917504.0 jvm_memory_pool_committed_bytes{pool="Metaspace"} 6946816.0 jvm_memory_pool_committed_bytes{pool="PS Eden Space"} 1.30023424E8 jvm_memory_pool_committed_bytes{pool="PS Old Gen"} 3.47078656E8 jvm_memory_pool_committed_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_init_bytes Initial bytes of a given JVM memory pool. # TYPE jvm_memory_pool_init_bytes gauge jvm_memory_pool_init_bytes{pool="Code Cache"} 2555904.0 jvm_memory_pool_init_bytes{pool="Compressed Class Space"} 0.0 jvm_memory_pool_init_bytes{pool="Metaspace"} 0.0 jvm_memory_pool_init_bytes{pool="PS Eden Space"} 1.30023424E8 jvm_memory_pool_init_bytes{pool="PS Old Gen"} 3.47078656E8 jvm_memory_pool_init_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_max_bytes Max bytes of a given JVM memory pool. # TYPE jvm_memory_pool_max_bytes gauge ``` -------------------------------- ### Example Cache Metrics Output Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/guava/CacheMetricsCollector.html Sample output of metrics exposed by the collector for a cache named 'mycache'. ```text guava_cache_hit_total{cache="mycache"} 10.0 guava_cache_miss_total{cache="mycache"} 3.0 guava_cache_requests_total{cache="mycache"} 13.0 guava_cache_eviction_total{cache="mycache"} 1.0 guava_cache_size{cache="mycache"} 5.0 ``` -------------------------------- ### Configure Tail Sampling for Exemplars Source: https://prometheus.github.io/client_java/otel/tracing Example configuration for the OpenTelemetry collector to sample spans marked with the exemplar attribute. ```yaml policies: [ { name: keep-exemplars, type: string_attribute, string_attribute: { key: "exemplar", values: ["true"] }, }, { name: keep-10-percent, type: probabilistic, probabilistic: { sampling_percentage: 10 } }, ] ``` -------------------------------- ### Registering Process Metrics with GaugeWithCallback Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/jvm/ProcessMetrics.Builder.html Examples of using GaugeWithCallback to register process-specific metrics like start time, file descriptors, and memory usage. ```java GaugeWithCallback.builder(config) .name(PROCESS_START_TIME_SECONDS) .help("Start time of the process since unix epoch in seconds.") .unit(Unit.SECONDS) .callback(callback -> callback.call(Unit.millisToSeconds(runtimeBean.getStartTime()))) .constLabels(constLabels) .register(registry); ``` ```java GaugeWithCallback.builder(config) .name(PROCESS_OPEN_FDS) .help("Number of open file descriptors.") .callback( callback -> { try { Long openFds = callLongGetter("getOpenFileDescriptorCount", osBean); if (openFds != null) { callback.call(openFds); } } catch (Exception ignored) { // Ignored } }) .constLabels(constLabels) .register(registry); ``` ```java GaugeWithCallback.builder(config) .name(PROCESS_MAX_FDS) .help("Maximum number of open file descriptors.") .callback( callback -> { try { Long maxFds = callLongGetter("getMaxFileDescriptorCount", osBean); if (maxFds != null) { callback.call(maxFds); } } catch (Exception ignored) { // Ignored } }) .constLabels(constLabels) .register(registry); ``` ```java GaugeWithCallback.builder(config) .name(PROCESS_VIRTUAL_MEMORY_BYTES) .help("Virtual memory size in bytes.") .unit(Unit.BYTES) .callback( callback -> { try { String line = grepper.lineStartingWith(PROC_SELF_STATUS, "VmSize:"); callback.call(Unit.kiloBytesToBytes(Double.parseDouble(line.split("\\s+")[1]))); } catch (Exception ignored) { // Ignored } }) .constLabels(constLabels) .register(registry); ``` ```java GaugeWithCallback.builder(config) .name(PROCESS_RESIDENT_MEMORY_BYTES) .help("Resident memory size in bytes.") .unit(Unit.BYTES) .callback( callback -> { try { String line = grepper.lineStartingWith(PROC_SELF_STATUS, "VmRSS:"); callback.call(Unit.kiloBytesToBytes(Double.parseDouble(line.split("\\s+")[1]))); } catch (Exception ignored) { // Ignored } }) .constLabels(constLabels) .register(registry); ``` -------------------------------- ### Example JVM Buffer Pool Metrics Output Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmBufferPoolMetrics.html Sample output showing the exported gauge metrics for buffer pool capacity, used buffers, and used bytes. ```text # HELP jvm_buffer_pool_capacity_bytes Bytes capacity of a given JVM buffer pool. # TYPE jvm_buffer_pool_capacity_bytes gauge jvm_buffer_pool_capacity_bytes{pool="direct"} 8192.0 jvm_buffer_pool_capacity_bytes{pool="mapped"} 0.0 # HELP jvm_buffer_pool_used_buffers Used buffers of a given JVM buffer pool. # TYPE jvm_buffer_pool_used_buffers gauge jvm_buffer_pool_used_buffers{pool="direct"} 1.0 jvm_buffer_pool_used_buffers{pool="mapped"} 0.0 # HELP jvm_buffer_pool_used_bytes Used bytes of a given JVM buffer pool. # TYPE jvm_buffer_pool_used_bytes gauge jvm_buffer_pool_used_bytes{pool="direct"} 8192.0 jvm_buffer_pool_used_bytes{pool="mapped"} 0.0 ``` -------------------------------- ### Example JVM Thread Metrics Output Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/instrumentation/jvm/JvmThreadsMetrics.html Sample output showing the format and types of metrics exported by JvmThreadsMetrics. ```text # HELP jvm_threads_current Current thread count of a JVM # TYPE jvm_threads_current gauge jvm_threads_current 10.0 # HELP jvm_threads_daemon Daemon thread count of a JVM # TYPE jvm_threads_daemon gauge jvm_threads_daemon 8.0 # HELP jvm_threads_deadlocked Cycles of JVM-threads that are in deadlock waiting to acquire object monitors or ownable synchronizers # TYPE jvm_threads_deadlocked gauge jvm_threads_deadlocked 0.0 # HELP jvm_threads_deadlocked_monitor Cycles of JVM-threads that are in deadlock waiting to acquire object monitors # TYPE jvm_threads_deadlocked_monitor gauge jvm_threads_deadlocked_monitor 0.0 # HELP jvm_threads_peak Peak thread count of a JVM # TYPE jvm_threads_peak gauge jvm_threads_peak 10.0 # HELP jvm_threads_started_total Started thread count of a JVM # TYPE jvm_threads_started_total counter jvm_threads_started_total 10.0 # HELP jvm_threads_state Current count of threads by state # TYPE jvm_threads_state gauge jvm_threads_state{state="BLOCKED"} 0.0 jvm_threads_state{state="NEW"} 0.0 jvm_threads_state{state="RUNNABLE"} 5.0 jvm_threads_state{state="TERMINATED"} 0.0 jvm_threads_state{state="TIMED_WAITING"} 2.0 jvm_threads_state{state="UNKNOWN"} 0.0 jvm_threads_state{state="WAITING"} 3.0 ``` -------------------------------- ### init() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/expositionformats/ExpositionFormats.html Initializes the ExpositionFormats configuration. ```APIDOC ### public static ExpositionFormats init() Initializes the ExpositionFormats configuration with default settings. ``` -------------------------------- ### Prometheus Metric Text Format Example Source: https://prometheus.github.io/client_java/getting-started/labels An example of how a counter metric with labels appears in the Prometheus text format. ```text # HELP payments_total total number of payments # TYPE payments_total counter payments_total{status="error",type="paypal"} 1.0 payments_total{status="success",type="credit card"} 3.0 payments_total{status="success",type="paypal"} 2.0 ``` -------------------------------- ### Register Process Start Time Gauge Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/jvm/ProcessMetrics.html Registers a gauge to track the process start time in seconds since the Unix epoch. ```java GaugeWithCallback.builder(config) .name(PROCESS_START_TIME_SECONDS) .help("Start time of the process since unix epoch in seconds.") .unit(Unit.SECONDS) .callback(callback -> callback.call(Unit.millisToSeconds(runtimeBean.getStartTime()))) .constLabels(constLabels) .register(registry); ``` -------------------------------- ### Initialize and Observe a Summary Metric Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/metrics/Summary.html Configures a Summary metric with quantiles and records an observation using a timer. ```java Summary summary = Summary.builder() .name("http_request_duration_seconds_hi") .help("HTTP request service time in seconds") .unit(SECONDS) .labelNames("method", "path", "status_code") .quantile(0.5, 0.01) .quantile(0.95, 0.001) .quantile(0.99, 0.001) .register(); long start = System.nanoTime(); // process a request, duration will be observed summary.labelValues("GET", "/", "200").observe(Unit.nanosToSeconds(System.nanoTime() - start)); ``` -------------------------------- ### get() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/datapoints/CounterDataPoint.html Retrieves the current value of the counter. ```APIDOC ## double get() ### Description Returns the current value of the counter as a double. ### Returns - (double) - The current counter value. ``` -------------------------------- ### Initialize ExpositionFormats Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/expositionformats/ExpositionFormats.html Use the init methods to create an instance of ExpositionFormats configured with Prometheus properties. ```java public static ExpositionFormats init() { return init(PrometheusProperties.get()); } @SuppressWarnings("deprecation") public static ExpositionFormats init(PrometheusProperties properties) { ExporterProperties exporterProps = properties.getExporterProperties(); OpenMetrics2Properties om2Props = properties.getOpenMetrics2Properties(); return new ExpositionFormats( new PrometheusProtobufWriter(), PrometheusTextFormatWriter.builder() .setIncludeCreatedTimestamps(exporterProps.getIncludeCreatedTimestamps()) .setTimestampsInMs(exporterProps.getPrometheusTimestampsInMs()) .build(), OpenMetricsTextFormatWriter.builder() .setCreatedTimestampsEnabled(exporterProps.getIncludeCreatedTimestamps()) .setExemplarsOnAllMetricTypesEnabled(exporterProps.getExemplarsOnAllMetricTypes()) .build(), OpenMetrics2TextFormatWriter.builder() .setOpenMetrics2Properties(om2Props) .setCreatedTimestampsEnabled(exporterProps.getIncludeCreatedTimestamps()) .setExemplarsOnAllMetricTypesEnabled(exporterProps.getExemplarsOnAllMetricTypes()) .build()); } ``` -------------------------------- ### Constructing Info Metrics Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/core/metrics/Info.Builder.html Demonstrates how to use the Info.builder() to create Info metric instances. ```java * .name("runtime_info") * .build(); * Info info2 = Info.builder() * .name("runtime") * .build(); * } ``` -------------------------------- ### init(PrometheusProperties properties) Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/expositionformats/ExpositionFormats.html Initializes the ExpositionFormats configuration using provided properties. ```APIDOC ### public static ExpositionFormats init(PrometheusProperties properties) Initializes the ExpositionFormats configuration using the specified PrometheusProperties. ``` -------------------------------- ### Creating and Registering an Info Metric Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/metrics/Info.html Demonstrates how to build and register an Info metric, then populate it with label values using system properties. ```java 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); ``` -------------------------------- ### CacheMetricsCollector Usage Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/caffeine/CacheMetricsCollector.Builder.html Example of how to initialize and register a CacheMetricsCollector to monitor a Caffeine cache. ```APIDOC ## CacheMetricsCollector Usage ### Description To monitor a Caffeine cache, instantiate a `CacheMetricsCollector` using the builder, register it with the `PrometheusRegistry`, and add the cache instance to the collector. ### Usage Example ```java // Note that `recordStats()` is required to gather non-zero statistics Cache cache = Caffeine.newBuilder().recordStats().build(); CacheMetricsCollector cacheMetrics = CacheMetricsCollector.builder().build(); PrometheusRegistry.defaultRegistry.register(cacheMetrics); cacheMetrics.addCache("mycache", cache); ``` ``` -------------------------------- ### Histogram Usage Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/core/metrics/Histogram.html Example of how to build and use a Histogram metric to record observations. ```APIDOC ## Histogram Usage ### Description Create a new Histogram metric using the builder, register it, and record observations using label values. ### Usage Example ```java Histogram histogram = Histogram.builder() .name("http_request_duration_seconds") .help("HTTP request service time in seconds") .unit(SECONDS) .labelNames("method", "path", "status_code") .register(); long start = System.nanoTime(); // do something histogram.labelValues("GET", "/", "200").observe(Unit.nanosToSeconds(System.nanoTime() - start)); ``` ``` -------------------------------- ### Label Name Validation Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/model/snapshots/PrometheusNaming.html Validates label names, ensuring they do not start with reserved prefixes. ```java public static boolean isValidLabelName(String name) { return isValidUtf8(name) && !(name.startsWith("__") || name.startsWith("._") || name.startsWith("..") || name.startsWith("_.")); } ``` -------------------------------- ### Load Properties from Environment Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/config/PrometheusPropertiesLoader.html Extracts environment variables starting with IO_PROMETHEUS and normalizes them to lowercase. ```java private static Map loadPropertiesFromEnvironment() { Map properties = new HashMap<>(); System.getenv() .forEach( (key, value) -> { if (key.startsWith("IO_PROMETHEUS")) { String normalizedKey = key.toLowerCase(java.util.Locale.ROOT); properties.put(normalizedKey, value); } }); return properties; } ``` -------------------------------- ### Configure PushGateway Builder Instance Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/pushgateway/PushGateway.Builder.html Methods for setting up the PushGateway builder with custom registry, escaping, and timestamp configurations. ```java public Builder instanceIpGroupingKey() throws UnknownHostException { return groupingKey("instance", InetAddress.getLocalHost().getHostAddress()); } /** Push metrics from this registry instead of {@link PrometheusRegistry#defaultRegistry}. */ public Builder registry(PrometheusRegistry registry) { this.registry = requireNonNull(registry, "registry must not be null"); return this; } /** * Specify the escaping scheme to be used when pushing metrics. Default is {@link * EscapingScheme#UNDERSCORE_ESCAPING}. */ public Builder escapingScheme(EscapingScheme escapingScheme) { this.escapingScheme = requireNonNull(escapingScheme, "escapingScheme must not be null"); return this; } /** * Use milliseconds for timestamps in text format? Default is {@code false}. Can be overwritten * at runtime with the {@code io.prometheus.exporter.timestamps_in_ms} property. */ public Builder prometheusTimestampsInMs(boolean prometheusTimestampsInMs) { this.prometheusTimestampsInMs = prometheusTimestampsInMs; return this; } ``` -------------------------------- ### Timer startTimer() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/datapoints/DistributionDataPoint.html Starts a timer to measure the duration of a code block, which is then recorded as an observation. ```APIDOC ### Method Timer startTimer() ### Description Starts a timer. Durations are recorded in seconds. ### Example ```java try (Timer timer = dataPoint.startTimer()) { // duration of this code block will be observed. } ``` ``` -------------------------------- ### Prometheus Scrape Job Configuration Snippet Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/exporter/httpserver/DefaultHandler.html Example configuration for filtering metrics in prometheus.yaml. ```yaml params: name[]: - my_metric_a - my_metric_b ``` -------------------------------- ### GET /metrics Source: https://prometheus.github.io/client_java/exporters/filter Queries the exporter for specific metrics by providing one or more name parameters. ```APIDOC ## GET /metrics ### Description Queries the exporter for specific metrics by providing one or more name parameters. ### Method GET ### Endpoint /metrics ### Parameters #### Query Parameters - **name[]** (string) - Optional - The name of the metric to query. Can be repeated to query multiple metrics. ``` -------------------------------- ### build() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/model/snapshots/SummarySnapshot.Builder.html Constructs and returns a new SummarySnapshot instance based on the configured builder state. ```APIDOC ### build **Signature:** `public SummarySnapshot build()` **Description:** Finalizes the configuration and returns a new SummarySnapshot instance. ``` -------------------------------- ### Get Prometheus Metric Names Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/guava/CacheMetricsCollector.html Returns the list of all metric names associated with the collector. ```java @Override @Deprecated @SuppressWarnings("InlineMeSuggester") public List getPrometheusNames() { return ALL_METRIC_NAMES; } ``` -------------------------------- ### build() Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/metrics/SummaryWithCallback.Builder.html Constructs and returns a new SummaryWithCallback instance based on the configured settings. ```APIDOC ### build() Finalizes the configuration and returns the built SummaryWithCallback instance. #### Returns - **SummaryWithCallback** - The constructed metric instance. ``` -------------------------------- ### Configure StateSet States and Build Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/core/metrics/StateSet.html Defines the allowed states for the StateSet and constructs the instance. Requires non-empty state names and throws exceptions if validation fails. ```java public Builder states(String... stateNames) { if (stateNames.length == 0) { throw new IllegalArgumentException("states cannot be empty"); } this.names = Stream.of(stateNames).distinct().sorted().toArray(String[]::new); return this; } @Override public StateSet build() { if (names == null) { throw new IllegalStateException("State names are required when building a StateSet."); } return new StateSet(this, names); } @Override protected Builder self() { return this; } } ``` -------------------------------- ### View Raw Metrics Output Source: https://prometheus.github.io/client_java/getting-started/quickstart Example of the expected output format for the custom counter metric. ```text # HELP my_count_total example counter # TYPE my_count_total counter my_count_total{status="error"} 1.0 my_count_total{status="ok"} 2.0 ``` -------------------------------- ### Registering and Using CounterDataPoint Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/core/datapoints/CounterDataPoint.html Demonstrates how to create a counter with labels and obtain specific CounterDataPoint instances for those labels. ```java Counter counter = Counter.builder() .name("tasks_total") .labelNames("status") .register(); CounterDataPoint newTasks = counter.labelValues("new"); CounterDataPoint pendingTasks = counter.labelValues("pending"); CounterDataPoint completedTasks = counter.labelValues("completed"); ``` -------------------------------- ### Prometheus Scrape Configuration Source: https://prometheus.github.io/client_java/getting-started/multi-target Example configuration for scraping multi-target endpoints using relabeling rules. ```yaml - job_name: "multi-target" # metrics_path defaults to '/metrics' # scheme defaults to 'http'. params: proc: [proc1, proc2] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: localhost:9401 static_configs: - targets: ["target1", "target2"] ``` -------------------------------- ### Configure and Build OpenMetrics 2.0 Properties Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/config/OpenMetrics2Properties.html Use enableAll to activate all features and build to instantiate the OpenMetrics2Properties object. ```java /** Enable all OpenMetrics 2.0 features */ public Builder enableAll() { this.enabled = true; this.contentNegotiation = true; this.compositeValues = true; this.exemplarCompliance = true; this.nativeHistograms = true; return this; } public OpenMetrics2Properties build() { return new OpenMetrics2Properties( enabled, contentNegotiation, compositeValues, exemplarCompliance, nativeHistograms); } } } ``` -------------------------------- ### HTTPServer.Builder Configuration Methods Source: https://prometheus.github.io/client_java/api/io/prometheus/metrics/exporter/httpserver/HTTPServer.Builder.html Methods available on the HTTPServer.Builder to configure the server instance. ```APIDOC ## HTTPServer.Builder Methods ### port(int port) Sets the port to bind to. Default is 0 (random port). ### hostname(String hostname) Sets the hostname to resolve the IP address. Cannot be used with inetAddress. ### inetAddress(InetAddress address) Sets the IP address to bind to. Cannot be used with hostname. ### executorService(ExecutorService executorService) Sets the ExecutorService used by the server. ### registry(PrometheusRegistry registry) Sets the PrometheusRegistry. Default is PrometheusRegistry.defaultRegistry. ### authenticator(Authenticator authenticator) Sets the Authenticator for server authentication. ### authenticatedSubjectAttributeName(String authenticatedSubjectAttributeName) Sets the attribute name of a Subject from a custom authenticator. ### httpsConfigurator(HttpsConfigurator configurator) Sets the HttpsConfigurator for TLS/SSL support. ### defaultHandler(HttpHandler defaultHandler) Overrides the default handler registered for the / endpoint. ### metricsHandlerPath(String metricsHandlerPath) Overrides the default path for the metrics endpoint. Default is /metrics. ### registerHealthHandler(boolean registerHealthHandler) Sets whether the health handler should be registered. Default is true. ### buildAndStart() Builds and starts the HTTPServer instance. Returns an HTTPServer object. ``` -------------------------------- ### Prometheus Metric Definitions Source: https://prometheus.github.io/client_java/api/src-html/io/prometheus/metrics/instrumentation/jvm/JvmMemoryMetrics.Builder.html Example output format for JVM memory pool and area metrics. ```text jvm_memory_pool_max_bytes{pool="Code Cache"} 2.5165824E8 jvm_memory_pool_max_bytes{pool="Compressed Class Space"} 1.073741824E9 jvm_memory_pool_max_bytes{pool="Metaspace"} -1.0 jvm_memory_pool_max_bytes{pool="PS Eden Space"} 2.727870464E9 jvm_memory_pool_max_bytes{pool="PS Old Gen"} 5.542248448E9 jvm_memory_pool_max_bytes{pool="PS Survivor Space"} 2.1495808E7 # HELP jvm_memory_pool_used_bytes Used bytes of a given JVM memory pool. # TYPE jvm_memory_pool_used_bytes gauge jvm_memory_pool_used_bytes{pool="Code Cache"} 4065472.0 jvm_memory_pool_used_bytes{pool="Compressed Class Space"} 766680.0 jvm_memory_pool_used_bytes{pool="Metaspace"} 6659432.0 jvm_memory_pool_used_bytes{pool="PS Eden Space"} 7801536.0 jvm_memory_pool_used_bytes{pool="PS Old Gen"} 1249696.0 jvm_memory_pool_used_bytes{pool="PS Survivor Space"} 0.0 # HELP jvm_memory_used_bytes Used bytes of a given JVM memory area. # TYPE jvm_memory_used_bytes gauge jvm_memory_used_bytes{area="heap"} 9051232.0 jvm_memory_used_bytes{area="nonheap"} 1.1490688E7 ```