From 02b5448d8b482f79a45586b214051843182e50e0 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:40:57 +0200 Subject: [PATCH 01/17] tomcat prefix + fix busy/idle threads --- .../src/main/resources/jmx/rules/tomcat.yaml | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml index 8d0f7f8835a5..3fe901d5ecc7 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml @@ -6,7 +6,7 @@ rules: - bean: Catalina:type=GlobalRequestProcessor,name=* unit: "1" - prefix: http.server.tomcat. + prefix: tomcat. metricAttribute: name: param(name) mapping: @@ -44,7 +44,7 @@ rules: direction: const(sent) - bean: Tomcat:type=GlobalRequestProcessor,name=* unit: "1" - prefix: http.server.tomcat. + prefix: tomcat. metricAttribute: name: param(name) mapping: @@ -83,56 +83,48 @@ rules: - bean: Catalina:type=Manager,host=localhost,context=* unit: "1" - prefix: http.server.tomcat. + prefix: tomcat.sessions. type: updowncounter metricAttribute: context: param(context) mapping: activeSessions: - metric: sessions.activeSessions + metric: activeSessions desc: The number of active sessions - bean: Tomcat:type=Manager,host=localhost,context=* unit: "1" - prefix: http.server.tomcat. + prefix: tomcat.sessions. type: updowncounter metricAttribute: context: param(context) mapping: activeSessions: - metric: sessions.activeSessions + metric: activeSessions desc: The number of active sessions - bean: Catalina:type=ThreadPool,name=* unit: "{threads}" - prefix: http.server.tomcat. + prefix: tomcat.threads. type: updowncounter metricAttribute: name: param(name) mapping: currentThreadCount: - metric: threads - desc: Thread Count of the Thread Pool - metricAttribute: - state: const(idle) + metric: currentThreadCount + desc: Total thread count of the thread pool currentThreadsBusy: - metric: threads - desc: Thread Count of the Thread Pool - metricAttribute: - state: const(busy) + metric: currentThreadsBusy + desc: Busy thread count of the thread pool - bean: Tomcat:type=ThreadPool,name=* unit: "{threads}" - prefix: http.server.tomcat. + prefix: tomcat.threads. type: updowncounter metricAttribute: name: param(name) mapping: currentThreadCount: - metric: threads - desc: Thread Count of the Thread Pool - metricAttribute: - state: const(idle) + metric: currentThreadCount + desc: Total thread count of the thread pool currentThreadsBusy: - metric: threads - desc: Thread Count of the Thread Pool - metricAttribute: - state: const(busy) + metric: currentThreadsBusy + desc: Busy thread count of the thread pool From cf151277cb2c58e82036e2ca95f0d1972f84cd71 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:15:53 +0200 Subject: [PATCH 02/17] tomcat align network metric/attributes --- .../src/main/resources/jmx/rules/tomcat.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml index 3fe901d5ecc7..c38caa892bfc 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml @@ -29,19 +29,19 @@ rules: unit: ms desc: Total time for processing all requests bytesReceived: - metric: traffic + metric: network.io type: counter unit: By desc: The number of bytes transmitted metricAttribute: - direction: const(received) + network.io.direction: const(receive) bytesSent: - metric: traffic + metric: network.io type: counter unit: By desc: The number of bytes transmitted metricAttribute: - direction: const(sent) + network.io.direction: const(transmit) - bean: Tomcat:type=GlobalRequestProcessor,name=* unit: "1" prefix: tomcat. @@ -67,19 +67,19 @@ rules: unit: ms desc: Total time for processing all requests bytesReceived: - metric: traffic + metric: network.io type: counter unit: By desc: The number of bytes transmitted metricAttribute: - direction: const(received) + network.io.direction: const(receive) bytesSent: - metric: traffic + metric: network.io type: counter unit: By desc: The number of bytes transmitted metricAttribute: - direction: const(sent) + network.io.direction: const(transmit) - bean: Catalina:type=Manager,host=localhost,context=* unit: "1" From d450d9a47c06966d93f513e4796c05b7f9575fc5 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:16:14 +0200 Subject: [PATCH 03/17] wildfly align 'sessions' in plural form --- .../javaagent/src/main/resources/jmx/rules/wildfly.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index b6d4c543257b..e90ccb3d7095 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -3,7 +3,7 @@ rules: - bean: jboss.as:deployment=*,subsystem=undertow metricAttribute: deployment: param(deployment) - prefix: wildfly.session. + prefix: wildfly.sessions. type: counter unit: "1" mapping: From 5c7688b84ec7739beb600cdc5f4895182f2f1d0d Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:16:45 +0200 Subject: [PATCH 04/17] wildfly align network.io with semconv attributes --- .../javaagent/src/main/resources/jmx/rules/wildfly.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index e90ccb3d7095..0bcef456d9ab 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -25,6 +25,7 @@ rules: unit: ns errorCount: - bean: jboss.as:subsystem=undertow,server=*,http-listener=* + metricPrefix: wildfly. metricAttribute: server: param(server) listener: param(http-listener) @@ -32,15 +33,15 @@ rules: unit: By mapping: bytesSent: - metric: wildfly.network.io + metric: network.io desc: Total number of bytes transferred metricAttribute: - direction: const(out) + network.io.direction: const(transmit) bytesReceived: - metric: wildfly.network.io + metric: network.io desc: Total number of bytes transferred metricAttribute: - direction: const(in) + network.io.direction: const(receive) - bean: jboss.as:subsystem=datasources,data-source=*,statistics=pool unit: "1" metricAttribute: From 4b966ccbc9b7f3b9dbe210708139dd284b417b66 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:52:32 +0200 Subject: [PATCH 05/17] update documentation --- .../jmx-metrics/javaagent/README.md | 12 ++++++++ .../src/main/resources/jmx/rules/wildfly.yaml | 3 +- .../jmx-metrics/javaagent/tomcat.md | 19 +++++++------ .../jmx-metrics/javaagent/wildfly.md | 28 +++++++++---------- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index 8680e878814e..57462328488c 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -32,6 +32,18 @@ No targets are enabled by default. The supported target environments are listed - [wildfly](wildfly.md) - [hadoop](hadoop.md) +### Predefined metrics mapping + +The pre-defined metrics do not provide an exhaustive mapping of every available JMX attribute as doing +so would be verbose, tedious to maintain and brittle as it relies on implementation details of each +of the targets supported. + +The following guidelines are recommended when modifying/extending pre-defined metrics: +- stay consistent with [semconv general guidelines](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md#general-guidelines) for metrics. +- start with `{target}.` prefix, where `{target}` is the target system, for example `tomcat` or `hadoop`. +- reuse the existing mbean attribute names as metric suffix to preserve semantics, for example `tomcat.errorCount` where tomcat reports as error any status >=400 and another app server might do differently. +- optionally align with semconv when semantics are identical, for example `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) + ## Configuration Files To provide your own metric definitions, create one or more YAML configuration files, and specify their location using the `otel.jmx.config` property. Absolute or relative pathnames can be specified. For example diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index 0bcef456d9ab..8e495c33fea2 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -56,10 +56,11 @@ rules: metric: wildfly.db.client.connections.usage metricAttribute: state: const(idle) - desc: The number of open jdbc connections + desc: The number of idle jdbc connections WaitCount: metric: wildfly.db.client.connections.WaitCount type: counter + desc: The number of waiting jdbc connections - bean: jboss.as:subsystem=transactions type: counter prefix: wildfly.db.client. diff --git a/instrumentation/jmx-metrics/javaagent/tomcat.md b/instrumentation/jmx-metrics/javaagent/tomcat.md index 6ac2e3fea16e..2f2d56e43290 100644 --- a/instrumentation/jmx-metrics/javaagent/tomcat.md +++ b/instrumentation/jmx-metrics/javaagent/tomcat.md @@ -2,12 +2,13 @@ Here is the list of metrics based on MBeans exposed by Tomcat. -| Metric Name | Type | Attributes | Description | -| ------------------------------------------ | ------------- | --------------- | --------------------------------------------------------------- | -| http.server.tomcat.sessions.activeSessions | UpDownCounter | context | The number of active sessions | -| http.server.tomcat.errorCount | Gauge | name | The number of errors per second on all request processors | -| http.server.tomcat.requestCount | Gauge | name | The number of requests per second across all request processors | -| http.server.tomcat.maxTime | Gauge | name | The longest request processing time | -| http.server.tomcat.processingTime | Counter | name | Represents the total time for processing all requests | -| http.server.tomcat.traffic | Counter | name, direction | The number of bytes transmitted | -| http.server.tomcat.threads | UpDownCounter | name, state | Thread Count of the Thread Pool | +| Metric Name | Type | Attributes | Description | +|-----------------------------------|---------------|----------------------------|-----------------------------------------------------------------| +| tomcat.sessions.activeSessions | UpDownCounter | context | The number of active sessions | +| tomcat.errorCount | Gauge | name | The number of errors per second on all request processors | +| tomcat.requestCount | Gauge | name | The number of requests per second across all request processors | +| tomcat.maxTime | Gauge | name | The longest request processing time | +| tomcat.processingTime | Counter | name | Represents the total time for processing all requests | +| tomcat.network.io | Counter | name, network.io.direction | The number of bytes transmitted | +| tomcat.threads.currentThreadCount | UpDownCounter | name | Total thread count of the thread pool | +| tomcat.threads.currentThreadsBusy | UpDownCounter | name | Busy thread count of the thread pool | diff --git a/instrumentation/jmx-metrics/javaagent/wildfly.md b/instrumentation/jmx-metrics/javaagent/wildfly.md index 637453a4ee33..3874ff34f8c5 100644 --- a/instrumentation/jmx-metrics/javaagent/wildfly.md +++ b/instrumentation/jmx-metrics/javaagent/wildfly.md @@ -2,17 +2,17 @@ Here is the list of metrics based on MBeans exposed by Wildfly. -| Metric Name | Type | Attributes | Description | -| -------------------------------------------------- | ------------- | ------------------ | ----------------------------------------------------------------------- | -| wildfly.network.io | Counter | direction, server | Total number of bytes transferred | -| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener | -| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served | -| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener | -| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired | -| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions | -| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created | -| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions | -| wildfly.db.client.connections.usage | Gauge | data_source, state | The number of open jdbc connections | -| wildfly.db.client.connections.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection | -| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back | -| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created | +| Metric Name | Type | Attributes | Description | +|----------------------------------------------------|---------------|------------------------------|-------------------------------------------------------------------------| +| wildfly.network.io | Counter | server, network.io.direction | Total number of bytes transferred | +| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener | +| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served | +| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener | +| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired | +| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions | +| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created | +| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions | +| wildfly.db.client.connections.usage | Gauge | data_source, state | The number of open jdbc connections | +| wildfly.db.client.connections.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection | +| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back | +| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created | From 2349720edb21c23a689f7ffcd99e261225d9d3f7 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:07:35 +0200 Subject: [PATCH 06/17] clarify doc --- instrumentation/jmx-metrics/javaagent/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index 57462328488c..ed743c67304d 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -41,8 +41,8 @@ of the targets supported. The following guidelines are recommended when modifying/extending pre-defined metrics: - stay consistent with [semconv general guidelines](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md#general-guidelines) for metrics. - start with `{target}.` prefix, where `{target}` is the target system, for example `tomcat` or `hadoop`. -- reuse the existing mbean attribute names as metric suffix to preserve semantics, for example `tomcat.errorCount` where tomcat reports as error any status >=400 and another app server might do differently. -- optionally align with semconv when semantics are identical, for example `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) +- align with semconv when semantics are identical, for example `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) +- when not fitting semconv, reuse the existing mbean attribute names as metric suffix to preserve semantics, for example `tomcat.errorCount` where tomcat reports as error any status >=400 and another app server might do differently. ## Configuration Files From cc85a160631299788ed3aea04e575a92cd0ac16f Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:10:32 +0200 Subject: [PATCH 07/17] doc again --- instrumentation/jmx-metrics/javaagent/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index ed743c67304d..2e8b2e7fa983 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -36,7 +36,8 @@ No targets are enabled by default. The supported target environments are listed The pre-defined metrics do not provide an exhaustive mapping of every available JMX attribute as doing so would be verbose, tedious to maintain and brittle as it relies on implementation details of each -of the targets supported. +of the targets supported. The goal here is to provide a monitoring of the essential metrics, advanced +use-cases will require dedicated configuration. The following guidelines are recommended when modifying/extending pre-defined metrics: - stay consistent with [semconv general guidelines](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md#general-guidelines) for metrics. From 64e9cddb6e8a7ae6e624519a57de1eec688a8629 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:13:11 +0200 Subject: [PATCH 08/17] reformat example --- instrumentation/jmx-metrics/javaagent/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index 2e8b2e7fa983..b69f94074352 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -42,7 +42,8 @@ use-cases will require dedicated configuration. The following guidelines are recommended when modifying/extending pre-defined metrics: - stay consistent with [semconv general guidelines](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/metrics.md#general-guidelines) for metrics. - start with `{target}.` prefix, where `{target}` is the target system, for example `tomcat` or `hadoop`. -- align with semconv when semantics are identical, for example `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) +- align with semconv when semantics are identical, for example: + - `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) - when not fitting semconv, reuse the existing mbean attribute names as metric suffix to preserve semantics, for example `tomcat.errorCount` where tomcat reports as error any status >=400 and another app server might do differently. ## Configuration Files From aa413432d5f3e474f21fa22e0e8ef03286a3488a Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:16:46 +0200 Subject: [PATCH 09/17] jetty singular thread metrics --- instrumentation/jmx-metrics/javaagent/jetty.md | 10 +++++----- .../javaagent/src/main/resources/jmx/rules/jetty.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/jetty.md b/instrumentation/jmx-metrics/javaagent/jetty.md index d771214cfc48..a9da2d1c2f3b 100644 --- a/instrumentation/jmx-metrics/javaagent/jetty.md +++ b/instrumentation/jmx-metrics/javaagent/jetty.md @@ -3,14 +3,14 @@ Here is the list of metrics based on MBeans exposed by Jetty. | Metric Name | Type | Attributes | Description | -| ------------------------------ | ------------- | ------------ | ---------------------------------------------------- | +|--------------------------------|---------------|--------------|------------------------------------------------------| | jetty.session.sessionsCreated | Counter | resource | The number of sessions established in total | | jetty.session.sessionTimeTotal | Counter | resource | The total time sessions have been active | | jetty.session.sessionTimeMax | Gauge | resource | The maximum amount of time a session has been active | | jetty.session.sessionTimeMean | Gauge | resource | The mean time sessions remain active | -| jetty.threads.busyThreads | UpDownCounter | | The current number of busy threads | -| jetty.threads.idleThreads | UpDownCounter | | The current number of idle threads | -| jetty.threads.maxThreads | UpDownCounter | | The maximum number of threads in the pool | -| jetty.threads.queueSize | UpDownCounter | | The current number of threads in the queue | +| jetty.thread.busyThreads | UpDownCounter | | The current number of busy threads | +| jetty.thread.idleThreads | UpDownCounter | | The current number of idle threads | +| jetty.thread.maxThreads | UpDownCounter | | The maximum number of threads in the pool | +| jetty.thread.queueSize | UpDownCounter | | The current number of threads in the queue | | jetty.io.selectCount | Counter | resource, id | The number of select calls | | jetty.logging.LoggerCount | UpDownCounter | | The number of registered loggers by name | diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml index ed5435d9cc20..8d34ed8367b8 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml @@ -22,7 +22,7 @@ rules: desc: The mean time sessions remain active - bean: org.eclipse.jetty.util.thread:type=queuedthreadpool,id=* - prefix: jetty.threads. + prefix: jetty.thread. unit: "{threads}" type: updowncounter mapping: From 3f9b71e36e84855e70edb5bf2be405a19c78e5fe Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:18:18 +0200 Subject: [PATCH 10/17] tomcat move to 'request' namespace --- .../src/main/resources/jmx/rules/tomcat.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml index c38caa892bfc..488c2e6c2243 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml @@ -11,7 +11,7 @@ rules: name: param(name) mapping: errorCount: - metric: errorCount + metric: request.errorCount type: gauge desc: The number of errors per second on all request processors requestCount: @@ -19,12 +19,12 @@ rules: type: gauge desc: The number of requests per second across all request processors maxTime: - metric: maxTime + metric: request.maxTime type: gauge unit: ms desc: The longest request processing time processingTime: - metric: processingTime + metric: request.processingTime type: counter unit: ms desc: Total time for processing all requests @@ -49,20 +49,20 @@ rules: name: param(name) mapping: errorCount: - metric: errorCount + metric: request.errorCount type: gauge desc: The number of errors per second on all request processors requestCount: - metric: requestCount + metric: request.requestCount type: gauge desc: The number of requests per second across all request processors maxTime: - metric: maxTime + metric: request.maxTime type: gauge unit: ms desc: The longest request processing time processingTime: - metric: processingTime + metric: request.processingTime type: counter unit: ms desc: Total time for processing all requests From fe09251263c9650e230bf690bda0868df53fac7d Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:19:13 +0200 Subject: [PATCH 11/17] tomcat singular session --- .../javaagent/src/main/resources/jmx/rules/tomcat.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml index 488c2e6c2243..0a376cd0218d 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml @@ -83,7 +83,7 @@ rules: - bean: Catalina:type=Manager,host=localhost,context=* unit: "1" - prefix: tomcat.sessions. + prefix: tomcat.session. type: updowncounter metricAttribute: context: param(context) @@ -93,7 +93,7 @@ rules: desc: The number of active sessions - bean: Tomcat:type=Manager,host=localhost,context=* unit: "1" - prefix: tomcat.sessions. + prefix: tomcat.session. type: updowncounter metricAttribute: context: param(context) From 931032b539dfa3ce9bb4f46e5cc6a653f4ebec76 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:34:50 +0200 Subject: [PATCH 12/17] singular units + tomcat fix --- .../src/main/resources/jmx/rules/jetty.yaml | 4 ++-- .../src/main/resources/jmx/rules/tomcat.yaml | 18 +++++++++++------- .../src/main/resources/jmx/rules/wildfly.yaml | 4 ++-- .../jmx-metrics/javaagent/tomcat.md | 10 +++++----- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml index 8d34ed8367b8..9e10cd160a6d 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/jetty.yaml @@ -8,7 +8,7 @@ rules: resource: param(context) mapping: sessionsCreated: - unit: "{sessions}" + unit: "{session}" type: counter desc: The number of sessions established in total sessionTimeTotal: @@ -23,7 +23,7 @@ rules: - bean: org.eclipse.jetty.util.thread:type=queuedthreadpool,id=* prefix: jetty.thread. - unit: "{threads}" + unit: "{thread}" type: updowncounter mapping: busyThreads: diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml index 0a376cd0218d..a9248c7853ea 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/tomcat.yaml @@ -13,10 +13,12 @@ rules: errorCount: metric: request.errorCount type: gauge + unit: "{request}" desc: The number of errors per second on all request processors requestCount: - metric: requestCount + metric: request.requestCount type: gauge + unit: "{request}" desc: The number of requests per second across all request processors maxTime: metric: request.maxTime @@ -51,10 +53,12 @@ rules: errorCount: metric: request.errorCount type: gauge + unit: "{request}" desc: The number of errors per second on all request processors requestCount: metric: request.requestCount type: gauge + unit: "{request}" desc: The number of requests per second across all request processors maxTime: metric: request.maxTime @@ -82,7 +86,7 @@ rules: network.io.direction: const(transmit) - bean: Catalina:type=Manager,host=localhost,context=* - unit: "1" + unit: "{session}" prefix: tomcat.session. type: updowncounter metricAttribute: @@ -92,7 +96,7 @@ rules: metric: activeSessions desc: The number of active sessions - bean: Tomcat:type=Manager,host=localhost,context=* - unit: "1" + unit: "{session}" prefix: tomcat.session. type: updowncounter metricAttribute: @@ -103,8 +107,8 @@ rules: desc: The number of active sessions - bean: Catalina:type=ThreadPool,name=* - unit: "{threads}" - prefix: tomcat.threads. + unit: "{thread}" + prefix: tomcat.thread. type: updowncounter metricAttribute: name: param(name) @@ -116,8 +120,8 @@ rules: metric: currentThreadsBusy desc: Busy thread count of the thread pool - bean: Tomcat:type=ThreadPool,name=* - unit: "{threads}" - prefix: tomcat.threads. + unit: "{thread}" + prefix: tomcat.thread. type: updowncounter metricAttribute: name: param(name) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index 8e495c33fea2..f8651b55a118 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -3,7 +3,7 @@ rules: - bean: jboss.as:deployment=*,subsystem=undertow metricAttribute: deployment: param(deployment) - prefix: wildfly.sessions. + prefix: wildfly.session. type: counter unit: "1" mapping: @@ -64,7 +64,7 @@ rules: - bean: jboss.as:subsystem=transactions type: counter prefix: wildfly.db.client. - unit: "{transactions}" + unit: "{transaction}" mapping: numberOfTransactions: metric: transaction.NumberOfTransactions diff --git a/instrumentation/jmx-metrics/javaagent/tomcat.md b/instrumentation/jmx-metrics/javaagent/tomcat.md index 2f2d56e43290..6d789ddd1a6f 100644 --- a/instrumentation/jmx-metrics/javaagent/tomcat.md +++ b/instrumentation/jmx-metrics/javaagent/tomcat.md @@ -4,11 +4,11 @@ Here is the list of metrics based on MBeans exposed by Tomcat. | Metric Name | Type | Attributes | Description | |-----------------------------------|---------------|----------------------------|-----------------------------------------------------------------| -| tomcat.sessions.activeSessions | UpDownCounter | context | The number of active sessions | -| tomcat.errorCount | Gauge | name | The number of errors per second on all request processors | -| tomcat.requestCount | Gauge | name | The number of requests per second across all request processors | -| tomcat.maxTime | Gauge | name | The longest request processing time | -| tomcat.processingTime | Counter | name | Represents the total time for processing all requests | +| tomcat.session.activeSessions | UpDownCounter | context | The number of active sessions | +| tomcat.request.errorCount | Gauge | name | The number of errors per second on all request processors | +| tomcat.request.requestCount | Gauge | name | The number of requests per second across all request processors | +| tomcat.request.maxTime | Gauge | name | The longest request processing time | +| tomcat.request.processingTime | Counter | name | Represents the total time for processing all requests | | tomcat.network.io | Counter | name, network.io.direction | The number of bytes transmitted | | tomcat.threads.currentThreadCount | UpDownCounter | name | Total thread count of the thread pool | | tomcat.threads.currentThreadsBusy | UpDownCounter | name | Busy thread count of the thread pool | From 313ed49042f9a75319fe8cdcdc16155bc738e8c0 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:01:12 +0200 Subject: [PATCH 13/17] fix tomcat request reference + clarify a bit --- instrumentation/jmx-metrics/javaagent/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index b69f94074352..3c6268c845c5 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -44,7 +44,7 @@ The following guidelines are recommended when modifying/extending pre-defined me - start with `{target}.` prefix, where `{target}` is the target system, for example `tomcat` or `hadoop`. - align with semconv when semantics are identical, for example: - `wildfly.network.io` is consistent with [`system.network.io`](https://opentelemetry.io/docs/specs/semconv/system/system-metrics/#metric-systemnetworkio) -- when not fitting semconv, reuse the existing mbean attribute names as metric suffix to preserve semantics, for example `tomcat.errorCount` where tomcat reports as error any status >=400 and another app server might do differently. +- when not fitting semconv, reuse the existing mbean attribute names as metric suffix to preserve semantics of the exposed MBeans, for example `tomcat.request.errorCount` where tomcat reports as error any status >=400 and another app server might do it differently. ## Configuration Files From 545a066e3d40d48015334165a2235b64e8df9404 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:26:25 +0200 Subject: [PATCH 14/17] fix doc for tomcat.thread.* --- .../jmx-metrics/javaagent/tomcat.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/tomcat.md b/instrumentation/jmx-metrics/javaagent/tomcat.md index 6d789ddd1a6f..4846e298ff1a 100644 --- a/instrumentation/jmx-metrics/javaagent/tomcat.md +++ b/instrumentation/jmx-metrics/javaagent/tomcat.md @@ -2,13 +2,13 @@ Here is the list of metrics based on MBeans exposed by Tomcat. -| Metric Name | Type | Attributes | Description | -|-----------------------------------|---------------|----------------------------|-----------------------------------------------------------------| -| tomcat.session.activeSessions | UpDownCounter | context | The number of active sessions | -| tomcat.request.errorCount | Gauge | name | The number of errors per second on all request processors | -| tomcat.request.requestCount | Gauge | name | The number of requests per second across all request processors | -| tomcat.request.maxTime | Gauge | name | The longest request processing time | -| tomcat.request.processingTime | Counter | name | Represents the total time for processing all requests | -| tomcat.network.io | Counter | name, network.io.direction | The number of bytes transmitted | -| tomcat.threads.currentThreadCount | UpDownCounter | name | Total thread count of the thread pool | -| tomcat.threads.currentThreadsBusy | UpDownCounter | name | Busy thread count of the thread pool | +| Metric Name | Type | Attributes | Description | +|----------------------------------|---------------|----------------------------|-----------------------------------------------------------------| +| tomcat.session.activeSessions | UpDownCounter | context | The number of active sessions | +| tomcat.request.errorCount | Gauge | name | The number of errors per second on all request processors | +| tomcat.request.requestCount | Gauge | name | The number of requests per second across all request processors | +| tomcat.request.maxTime | Gauge | name | The longest request processing time | +| tomcat.request.processingTime | Counter | name | Represents the total time for processing all requests | +| tomcat.network.io | Counter | name, network.io.direction | The number of bytes transmitted | +| tomcat.thread.currentThreadCount | UpDownCounter | name | Total thread count of the thread pool | +| tomcat.thread.currentThreadsBusy | UpDownCounter | name | Busy thread count of the thread pool | From cb27853be49c62df67a115e83ef25c1e0d014108 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:46:56 +0200 Subject: [PATCH 15/17] wildfly align with upcoming semconv --- .../src/main/resources/jmx/rules/wildfly.yaml | 8 +++--- .../jmx-metrics/javaagent/wildfly.md | 28 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index f8651b55a118..79f0380a3eb7 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -43,19 +43,19 @@ rules: metricAttribute: network.io.direction: const(receive) - bean: jboss.as:subsystem=datasources,data-source=*,statistics=pool - unit: "1" + unit: "{connection}" metricAttribute: data_source: param(data-source) mapping: ActiveCount: - metric: wildfly.db.client.connections.usage + metric: wildfly.db.client.connection.count metricAttribute: - state: const(used) + db.client.connection.state: const(used) desc: The number of open jdbc connections IdleCount: metric: wildfly.db.client.connections.usage metricAttribute: - state: const(idle) + db.client.connection.state: const(idle) desc: The number of idle jdbc connections WaitCount: metric: wildfly.db.client.connections.WaitCount diff --git a/instrumentation/jmx-metrics/javaagent/wildfly.md b/instrumentation/jmx-metrics/javaagent/wildfly.md index 3874ff34f8c5..cf8dd4c1321a 100644 --- a/instrumentation/jmx-metrics/javaagent/wildfly.md +++ b/instrumentation/jmx-metrics/javaagent/wildfly.md @@ -2,17 +2,17 @@ Here is the list of metrics based on MBeans exposed by Wildfly. -| Metric Name | Type | Attributes | Description | -|----------------------------------------------------|---------------|------------------------------|-------------------------------------------------------------------------| -| wildfly.network.io | Counter | server, network.io.direction | Total number of bytes transferred | -| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener | -| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served | -| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener | -| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired | -| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions | -| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created | -| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions | -| wildfly.db.client.connections.usage | Gauge | data_source, state | The number of open jdbc connections | -| wildfly.db.client.connections.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection | -| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back | -| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created | +| Metric Name | Type | Attributes | Description | +|----------------------------------------------------|---------------|------------------------------------------|-------------------------------------------------------------------------| +| wildfly.network.io | Counter | server, network.io.direction | Total number of bytes transferred | +| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener | +| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served | +| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener | +| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired | +| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions | +| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created | +| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions | +| wildfly.db.client.connection.usage | Gauge | data_source, db.client.connections.state | The number of open jdbc connections | +| wildfly.db.client.connection.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection | +| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back | +| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created | From 286d784ae01b89f68e5bab0f9f6fb91fb343a1d1 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:07:15 +0200 Subject: [PATCH 16/17] wildfly transaction name fits mbean attribute --- .../javaagent/src/main/resources/jmx/rules/wildfly.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index 79f0380a3eb7..61d759b7b445 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -67,7 +67,7 @@ rules: unit: "{transaction}" mapping: numberOfTransactions: - metric: transaction.NumberOfTransactions + metric: transaction.numberOfTransactions numberOfApplicationRollbacks: metric: rollback.count metricAttribute: From fb71fa107ce7351467d76e3b2a1c49eb2cd6a074 Mon Sep 17 00:00:00 2001 From: Sylvain Juge <763082+SylvainJuge@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:56:26 +0200 Subject: [PATCH 17/17] simplify metrics for wildfly --- .../src/main/resources/jmx/rules/wildfly.yaml | 13 +++++++------ instrumentation/jmx-metrics/javaagent/wildfly.md | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml index 61d759b7b445..5bf455f40615 100644 --- a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/wildfly.yaml @@ -51,16 +51,17 @@ rules: metric: wildfly.db.client.connection.count metricAttribute: db.client.connection.state: const(used) - desc: The number of open jdbc connections + desc: The number of in-use physical jdbc connections IdleCount: - metric: wildfly.db.client.connections.usage + metric: wildfly.db.client.connections.count metricAttribute: db.client.connection.state: const(idle) - desc: The number of idle jdbc connections + desc: The number of idle physical jdbc connections WaitCount: - metric: wildfly.db.client.connections.WaitCount - type: counter - desc: The number of waiting jdbc connections + metric: wildfly.db.client.connection.count + metricAttribute: + db.client.connection.state: const(idle) + desc: The number of waiting logical jdbc connections - bean: jboss.as:subsystem=transactions type: counter prefix: wildfly.db.client. diff --git a/instrumentation/jmx-metrics/javaagent/wildfly.md b/instrumentation/jmx-metrics/javaagent/wildfly.md index cf8dd4c1321a..2444b848e85a 100644 --- a/instrumentation/jmx-metrics/javaagent/wildfly.md +++ b/instrumentation/jmx-metrics/javaagent/wildfly.md @@ -12,7 +12,6 @@ Here is the list of metrics based on MBeans exposed by Wildfly. | wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions | | wildfly.session.sessionsCreated | Counter | deployment | Total sessions created | | wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions | -| wildfly.db.client.connection.usage | Gauge | data_source, db.client.connections.state | The number of open jdbc connections | -| wildfly.db.client.connection.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection | +| wildfly.db.client.connection.count | Gauge | data_source, db.client.connections.state | The number of open jdbc connections | | wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back | | wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created |