Automatic configuration

JVM metrics collection is enabled by default for Java tracer v0.29.0+. It can be disabled with one configuration parameter in the tracing client, either through a system property, -Ddd.jmxfetch.enabled=false, or through an environment variable, DD_JMXFETCH_ENABLED=false. As of v0.64.0+, you can also use the DD_RUNTIME_METRICS_ENABLED=false environment variable to disable it.

JVM metrics can be viewed in correlation with your Java services. See the Service Catalog in Datadog.

JVM Runtime

By default, runtime metrics from your application are sent to the Datadog Agent with DogStatsD over port 8125. Make sure that DogStatsD is enabled for the Agent.

If you are running the Agent as a container, ensure that DD_DOGSTATSD_NON_LOCAL_TRAFFIC is set to true, and that port 8125 is open on the Agent. Additionally, for:

Alternatively, the Agent can ingest metrics with a Unix Domain Socket (UDS) as an alternative to UDP transport. For more information, read DogStatsD over Unix Domain Socket.

Notes:

  • For the runtime UI, dd-trace-java >= 0.24.0 is supported.
  • To associate JVM metrics within flame graphs, ensure the env: tag (case-sensitive) is set and matching across your environment.
  • For JVM metrics to appear on the service page when using Fargate, ensure that DD_DOGSTATSD_TAGS is set on your Agent task, and matches the env: tag of that service.

Data Collected

The following metrics are collected by default per JVM process after enabling JVM metrics.

jvm.heap_memory
(gauge)
The total Java heap memory used.
Shown as byte
jvm.heap_memory_committed
(gauge)
The total Java heap memory committed to be used.
Shown as byte
jvm.heap_memory_init
(gauge)
The initial Java heap memory allocated.
Shown as byte
jvm.heap_memory_max
(gauge)
The maximum Java heap memory available.
Shown as byte
jvm.non_heap_memory
(gauge)
The total Java non-heap memory used. Non-heap memory is calculated as follows: Metaspace + CompressedClassSpace + CodeCache
Shown as byte
jvm.non_heap_memory_committed
(gauge)
The total Java non-heap memory committed to be used.
Shown as byte
jvm.non_heap_memory_init
(gauge)
The initial Java non-heap memory allocated.
Shown as byte
jvm.non_heap_memory_max
(gauge)
The maximum Java non-heap memory available.
Shown as byte
jvm.thread_count
(count)
The number of live threads.
Shown as thread
jvm.gc.cms.count
(count)
The total number of garbage collections that have occurred.
jvm.gc.major_collection_count
(gauge)
The rate of major garbage collections. Set new_gc_metrics: true to receive this metric.
jvm.gc.minor_collection_count
(gauge)
The rate of minor garbage collections. Set new_gc_metrics: true to receive this metric.
jvm.gc.parnew.time
(gauge)
The approximate accumulated garbage collection time elapsed.
Shown as millisecond
jvm.gc.major_collection_time
(gauge)
The fraction of time spent in major garbage collection. Set new_gc_metrics: true to receive this metric.
Shown as permille
jvm.gc.minor_collection_time
(gauge)
The fraction of time spent in minor garbage collection. Set new_gc_metrics: true to receive this metric.
Shown as permille

Along with displaying these metrics in your APM Service Page, Datadog provides a default JVM Runtime Dashboard.

Additional JMX metrics can be added using configuration files that are passed on using dd.jmxfetch.config.dir and dd.jmxfetch.config. You can also enable existing Datadog JMX integrations individually with the dd.jmxfetch.<INTEGRATION_NAME>.enabled=true parameter. This auto-embeds configuration from Datadog’s existing JMX configuration files. See the JMX Integration for further details on configuration.

Further Reading