Skip to content
5 changes: 4 additions & 1 deletion instrumentation/jmx-metrics/src/main/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ OTEL_EXPERIMENTAL_METRICS_VIEW_CONFIG: classpath:/jmx/view.yaml

### rules/*.yaml
The rules are a translation of the JMX Metric Gatherer's [target systems](https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/jmx-metrics/src/main/resources/target-systems)
based on the [JMX metric rule YAML schema](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jmx-metrics/javaagent/README.md#basic-syntax).
based on the [JMX metric rule YAML schema](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jmx-metrics/javaagent/README.md#basic-syntax).

### SystemCpuLoad
The `SystemCpuLoad` metric is deprecated and Java versions 14+ now use `CpuLoad`. However, to avoid emitting double metrics, we stick to using `SystemCpuLoad` as it still works on newer versions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,45 @@ rules:
ThreadCount:
metric: count
desc: Number of threads
DaemonThreadCount:
metric: daemon
desc: Number of daemon threads
- bean: java.lang:type=OperatingSystem,*
prefix: jvm.cpu.
type: gauge
mapping:
TotalSwapSpaceSize:
metric: jvm.system.swap.space.total
desc: The host swap memory size in bytes
unit: by
FreeSwapSpaceSize:
metric: jvm.system.swap.space.free
desc: The amount of available swap memory in bytes
unit: by
TotalPhysicalMemorySize:
metric: jvm.system.physical.memory.total
desc: The total physical memory size in host
unit: by
FreePhysicalMemorySize:
metric: jvm.system.physical.memory.free
desc: The amount of free physical memory in host
unit: by
AvailableProcessors:
metric: jvm.system.available.processors
desc: The number of available processors
unit: "1"
SystemCpuLoad:
metric: jvm.system.cpu.utilization
desc: The current load of CPU in host
unit: "1"
ProcessCpuTime:
metric: time
metric: jvm.cpu.time
unit: ns
desc: CPU time used
ProcessCpuLoad:
metric: recent_utilization
metric: jvm.cpu.recent_utilization
unit: "1"
desc: Recent CPU utilization for the process
OpenFileDescriptorCount:
metric: jvm.open_file_descriptor.count
desc: The number of opened file descriptors
unit: "1"
134 changes: 134 additions & 0 deletions instrumentation/jmx-metrics/src/main/resources/jmx/rules/tomcat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
rules:
- bean: Catalina:type=Manager,host=localhost,context=*
unit: sessions
type: gauge
mapping:
activeSessions:
metric: tomcat.sessions
desc: The number of active sessions.
rejectedSessions:
metric: tomcat.rejected_sessions
desc: The number of rejected sessions.
- bean: Catalina:type=GlobalRequestProcessor,name=*
metricAttribute:
name: param(name)
mapping:
errorCount:
metric: tomcat.errors
type: counter
unit: errors
desc: The number of errors encountered.
requestCount:
metric: tomcat.request_count
type: counter
unit: requests
desc: The total requests.
maxTime:
metric: tomcat.max_time
type: gauge
unit: ms
desc: Maximum time to process a request
processingTime:
metric: tomcat.processing_time
type: counter
unit: ms
desc: The total processing time.
bytesReceived:
metric: tomcat.traffic
metricAttribute:
direction: const(received)
type: counter
unit: by
desc: The number of bytes transmitted and received.
bytesSent:
metric: tomcat.traffic
metricAttribute:
direction: const(sent)
type: counter
unit: by
desc: The number of bytes transmitted and received.
- bean: Catalina:type=ThreadPool,name=*
metricAttribute:
name: param(name)
mapping:
currentThreadCount:
metric: tomcat.threads
metricAttribute:
state: const(idle)
type: gauge
unit: threads
desc: The number of threads
currentThreadsBusy:
metric: tomcat.threads
metricAttribute:
state: const(busy)
type: gauge
unit: threads
desc: The number of threads
- bean: Tomcat:type=Manager,host=localhost,context=*
unit: sessions
type: gauge
mapping:
activeSessions:
metric: tomcat.sessions
desc: The number of active sessions.
rejectedSessions:
metric: tomcat.rejected_sessions
desc: The number of rejected sessions.
- bean: Tomcat:type=GlobalRequestProcessor,name=*
metricAttribute:
name: param(name)
mapping:
errorCount:
metric: tomcat.errors
type: counter
unit: errors
desc: The number of errors encountered.
requestCount:
metric: tomcat.request_count
type: counter
unit: requests
desc: The total requests.
maxTime:
metric: tomcat.max_time
type: gauge
unit: ms
desc: Maximum time to process a request
processingTime:
metric: tomcat.processing_time
type: counter
unit: ms
desc: The total processing time.
bytesReceived:
metric: tomcat.traffic
metricAttribute:
direction: const(received)
type: counter
unit: by
desc: The number of bytes transmitted and received.
bytesSent:
metric: tomcat.traffic
metricAttribute:
direction: const(sent)
type: counter
unit: by
desc: The number of bytes transmitted and received.
- bean: Tomcat:type=ThreadPool,name=*
metricAttribute:
name: param(name)
mapping:
currentThreadCount:
metric: tomcat.threads
metricAttribute:
state: const(idle)
type: gauge
unit: threads
desc: The number of threads
currentThreadsBusy:
metric: tomcat.threads
metricAttribute:
state: const(busy)
type: gauge
unit: threads
desc: The number of threads