From 7e46def54364250982a789ebe91f6cc8ea12323f Mon Sep 17 00:00:00 2001 From: Luigi De Masi Date: Thu, 25 Jul 2024 16:14:13 +0200 Subject: [PATCH] Added rules for capturing Apache Camel metrics exposed by jmx MBean --- .../jmx-metrics/javaagent/README.md | 1 + .../jmx-metrics/javaagent/camel.md | 54 +++++ .../src/main/resources/jmx/rules/camel.yaml | 227 ++++++++++++++++++ .../jmx/JmxMetricInsightInstallerTest.java | 1 + 4 files changed, 283 insertions(+) create mode 100644 instrumentation/jmx-metrics/javaagent/camel.md create mode 100644 instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/camel.yaml diff --git a/instrumentation/jmx-metrics/javaagent/README.md b/instrumentation/jmx-metrics/javaagent/README.md index 8680e878814e..844137872f82 100644 --- a/instrumentation/jmx-metrics/javaagent/README.md +++ b/instrumentation/jmx-metrics/javaagent/README.md @@ -26,6 +26,7 @@ $ java -javaagent:path/to/opentelemetry-javaagent.jar \ No targets are enabled by default. The supported target environments are listed below. - [activemq](activemq.md) +- [camel](camel.md) - [jetty](jetty.md) - [kafka-broker](kafka-broker.md) - [tomcat](tomcat.md) diff --git a/instrumentation/jmx-metrics/javaagent/camel.md b/instrumentation/jmx-metrics/javaagent/camel.md new file mode 100644 index 000000000000..5ea9d4dd21d2 --- /dev/null +++ b/instrumentation/jmx-metrics/javaagent/camel.md @@ -0,0 +1,54 @@ +# Camel Metrics + +Here is the list of metrics based on MBeans exposed by Camel. + +| Metric Name | Type | Attributes | Description | +|--------------------------------------------------------|---------|----------------------------------------|--------------------------------------------------------------------------------------| +| org.apache.camel.context.exchanges.completed | Counter | context, camelVersion | Exchanges Completed grouped by Camel Context | +| org.apache.camel.context.exchanges.failed | Counter | context, camelVersion | Exchanges Failed grouped by Camel Context | +| org.apache.camel.context.exchanges.inflight | Counter | context, camelVersion | Exchanges Inflight grouped by Camel Context | +| org.apache.camel.context.exchanges.total | Counter | context, camelVersion | Exchanges Total grouped by Camel Context | +| org.apache.camel.context.failures.handled | Counter | context, camelVersion | Failures Handled grouped by Camel Context | +| org.apache.camel.context.external.redeliveries.count | Counter | context, camelVersion | External Redeliveries grouped by Camel Context | +| org.apache.camel.context.max.processing.time | Gauge | context, camelVersion | Maximum Processing Time grouped by Camel Context | +| org.apache.camel.context.mean.processing.time | Gauge | context, camelVersion | Mean Processing Time grouped by Camel Context | +| org.apache.camel.context.min.processing.time | Gauge | context, camelVersion | Min Processing Time grouped by Camel Context | +| org.apache.camel.context.last.processing.time | Gauge | context, camelVersion | Last Processing Time grouped by Camel Context | +| org.apache.camel.context.delta.processing.time | Gauge | context, camelVersion | Delta Processing Time grouped by Camel Context | +| org.apache.camel.context.total.processing.time | Gauge | context, camelVersion | Total Processing Time grouped by Camel Context | +| org.apache.camel.context.redeliveries.count | Counter | context, camelVersion | Redeliveries count grouped by Camel Context | +| org.apache.camel.context.inflight.exchanges | Gauge | context, camelVersion | Inflight Exchanges grouped by Camel Context | +| org.apache.camel.route.exchanges.completed | Counter | context, route | Exchanges Completed grouped by Camel Route | +| org.apache.camel.route.exchanges.failed | Counter | context, route | Exchanges Failed grouped by Camel Route | +| org.apache.camel.route.exchanges.inflight | Counter | context, route | Exchanges Inflight grouped by Camel Route | +| org.apache.camel.route.exchanges.total | Counter | context, route | Exchanges Total grouped by Camel Route | +| org.apache.camel.route.failures.handled | Counter | context, route | Failures Handled grouped by Camel Route | +| org.apache.camel.route.external.redeliveries.count | Counter | context, route | External Redeliveries grouped by Camel Route | +| org.apache.camel.route.max.processing.time | Gauge | context, route | Maximum Processing Time grouped by Camel Route | +| org.apache.camel.route.mean.processing.time | Gauge | context, route | Mean Processing Time grouped by Camel Route | +| org.apache.camel.route.min.processing.time | Gauge | context, route | Min Processing Time grouped by Camel Route | +| org.apache.camel.route.last.processing.time | Gauge | context, route | Last Processing Time grouped by Camel Route | +| org.apache.camel.route.delta.processing.time | Gauge | context, route | Delta Processing Time grouped by Camel Route | +| org.apache.camel.route.total.processing.time | Gauge | context, route | Total Processing Time grouped by Camel Route | +| org.apache.camel.route.redeliveries.count | Counter | context, route | Redeliveries count grouped by Camel Route | +| org.apache.camel.route.inflight.exchanges | Gauge | context, route | Inflight Exchanges grouped by Camel Route | +| org.apache.camel.processor.exchanges.completed | Counter | context, route, processor, destination | Exchanges Completed grouped by Camel Processor | +| org.apache.camel.processor.exchanges.failed | Counter | context, route, processor, destination | Exchanges Failed grouped by Camel Processor | +| org.apache.camel.processor.exchanges.inflight | Counter | context, route, processor, destination | Exchanges Inflight grouped by Camel Processor | +| org.apache.camel.processor.exchanges.total | Counter | context, route, processor, destination | Exchanges Total grouped by Camel Processor | +| org.apache.camel.processor.failures.handled | Counter | context, route, processor, destination | Failures Handled grouped by Camel Processor | +| org.apache.camel.processor.external.redeliveries.count | Counter | context, route, processor, destination | External Redeliveries grouped by Camel Processor | +| org.apache.camel.processor.max.processing.time | Gauge | context, route, processor, destination | Maximum Processing Time grouped by Camel Processor | +| org.apache.camel.processor.mean.processing.time | Gauge | context, route, processor, destination | Mean Processing Time grouped by Camel Processor | +| org.apache.camel.processor.min.processing.time | Gauge | context, route, processor, destination | Min Processing Time grouped by Camel Processor | +| org.apache.camel.processor.last.processing.time | Gauge | context, route, processor, destination | Last Processing Time grouped by Camel Processor | +| org.apache.camel.processor.delta.processing.time | Gauge | context, route, processor, destination | Delta Processing Time grouped by Camel Processor | +| org.apache.camel.processor.total.processing.time | Gauge | context, route, processor, destination | Total Processing Time grouped by Camel Processor | +| org.apache.camel.processor.redeliveries.count | Counter | context, route, processor, destination | Redeliveries count grouped by Camel Processor | +| org.apache.camel.processor.inflight.exchanges | Gauge | context, route, processor, destination | Inflight Exchanges grouped by Camel Processor | +| org.apache.camel.threadpool.active.count | Gauge | context, route | The approximate number of threads that are actively executing tasks. | +| org.apache.camel.threadpool.completed.task.count | Counter | context, route | The approximate total number of tasks that have completed execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls. | +| org.apache.camel.threadpool.pool.size | Gauge | context, route | The current number of threads in the pool. | +| org.apache.camel.threadpool.largest.pool.size | Gauge | context, route | The largest number of threads that have ever simultaneously been in the pool. | +| org.apache.camel.threadpool.task.count | Gauge | context, route | The approximate total number of tasks that have ever been scheduled for execution. | +| org.apache.camel.threadpool.task.queue.size | Gauge | context, route | The number of Tasks in the Task Queue | diff --git a/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/camel.yaml b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/camel.yaml new file mode 100644 index 000000000000..3eda23d40ef4 --- /dev/null +++ b/instrumentation/jmx-metrics/javaagent/src/main/resources/jmx/rules/camel.yaml @@ -0,0 +1,227 @@ +--- +rules: + - bean: org.apache.camel:context=*,type=context,name=* + prefix: org.apache.camel.context. + metricAttribute: + context: param(context) + camelVersion: beanattr(CamelVersion) + mapping: + ExchangesCompleted: + metric: exchanges.completed + type: counter + desc: Exchanges Completed grouped by Camel Context + ExchangesFailed: + metric: exchanges.failed + type: counter + desc: Exchanges Failed grouped by Camel Context + ExchangesInflight: + metric: exchanges.inflight + type: counter + desc: Exchanges Inflight grouped by Camel Context + ExchangesTotal: + metric: exchanges.total + type: counter + desc: Exchanges Total grouped by Camel Context + FailuresHandled: + metric: failures.handled + type: counter + desc: Failures Handled grouped by Camel Context + ExternalRedeliveries: + metric: external.redeliveries.count + type: counter + desc: External Redeliveries grouped by Camel Context + MaxProcessingTime: + metric: max.processing.time + type: gauge + desc: Maximum Processing Time grouped by Camel Context + MeanProcessingTime: + metric: mean.processing.time + type: gauge + desc: Mean Processing Time grouped by Camel Context + MinProcessingTime: + metric: min.processing.time + type: gauge + desc: Min Processing Time grouped by Camel Context + LastProcessingTime: + metric: last.processing.time + type: gauge + desc: Last Processing Time grouped by Camel Context + DeltaProcessingTime: + metric: delta.processing.time + type: gauge + desc: Delta Processing Time grouped by Camel Context + TotalProcessingTime: + metric: total.processing.time + type: gauge + desc: Total Processing Time grouped by Camel Context + Redeliveries: + metric: redeliveries.count + type: counter + desc: Redeliveries grouped by Camel Context + InflightExchanges: + metric: inflight.exchanges + type: gauge + desc: Inflight Exchanges grouped by Camel Context + +# Route Level metrics + + - bean: org.apache.camel:context=*,type=routes,name=* + prefix: org.apache.camel.route. + metricAttribute: + route: beanattr(RouteId) + context: param(context) + mapping: + ExchangesCompleted: + metric: exchanges.completed + type: counter + desc: Exchanges Completed grouped by Camel Route + ExchangesFailed: + metric: exchanges.failed + type: counter + desc: Exchanges Completed grouped by Camel Route + ExchangesInflight: + metric: exchanges.inflight + type: counter + desc: Exchanges Inflight grouped by Camel Route + ExchangesTotal: + metric: exchanges.total + type: counter + desc: Exchanges Total grouped by Camel Route + FailuresHandled: + metric: failures.handled + type: counter + desc: Failures Handled grouped by Camel Route + ExternalRedeliveries: + metric: external.redeliveries.count + type: counter + desc: External Redeliveries grouped by Camel Route + MaxProcessingTime: + metric: max.processing.time + type: gauge + desc: Maximum Processing Time grouped by Camel Route + MeanProcessingTime: + metric: mean.processing.time + type: gauge + desc: Mean Processing Time grouped by Camel Route + MinProcessingTime: + metric: min.processing.time + type: gauge + desc: Min Processing Time grouped by Camel Route + LastProcessingTime: + metric: last.processing.time + type: gauge + desc: Last Processing Time grouped by Camel Route + DeltaProcessingTime: + metric: delta.processing.time + type: gauge + desc: Delta Processing Time grouped by Camel Route + TotalProcessingTime: + metric: total.processing.time + type: gauge + desc: Total Processing Time grouped by Camel Route + Redeliveries: + metric: redeliveries.count + type: counter + desc: Redeliveries grouped by Camel Route + InflightExchanges: + metric: inflight.exchanges + type: gauge + desc: Inflight Exchanges grouped by Camel Route + +# Processor level Metrics + + - bean: org.apache.camel:context=*,type=processors,name=* + prefix: org.apache.camel.processor. + metricAttribute: + processor: beanattr(ProcessorId) + route: beanattr(RouteId) + context: param(context) + destination: beanattr(Destination) + mapping: + ExchangesCompleted: + metric: exchanges.completed + type: counter + desc: Exchanges Completed grouped by Camel Processor + ExchangesFailed: + metric: exchanges.failed + type: counter + desc: Exchanges Completed grouped by Camel Processor + ExchangesInflight: + metric: exchanges.inflight + type: counter + desc: Exchanges Inflight grouped by Camel Processor + ExchangesTotal: + metric: exchanges.total + type: counter + desc: Exchanges Total grouped by Camel Processor + FailuresHandled: + metric: failures.handled + type: counter + desc: Failures Handled grouped by Camel Processor + ExternalRedeliveries: + metric: external.redeliveries.count + type: counter + desc: External Redeliveries grouped by Camel Processor + MaxProcessingTime: + metric: max.processing.time + type: gauge + desc: Maximum Processing Time grouped by Camel Processor + MeanProcessingTime: + metric: mean.processing.time + type: gauge + desc: Mean Processing Time grouped by Camel Processor + MinProcessingTime: + metric: min.processing.time + type: gauge + desc: Min Processing Time grouped by Camel Processor + LastProcessingTime: + metric: last.processing.time + type: gauge + desc: Last Processing Time grouped by Camel Processor + DeltaProcessingTime: + metric: delta.processing.time + type: gauge + desc: Delta Processing Time grouped by Camel Processor + TotalProcessingTime: + metric: total.processing.time + type: gauge + desc: Total Processing Time grouped by Camel Processor + Redeliveries: + metric: redeliveries.count + type: counter + desc: Number of redeliveries grouped by Camel Processor + InflightExchanges: + metric: inflight.exchanges + type: gauge + desc: Inflight Exchanges grouped by Camel Processor + + - bean: org.apache.camel:context=*,type=threadpools,name=* + prefix: org.apache.camel.threadpool. + metricAttribute: + route: beanattr(RouteId) + context: param(context) + mapping: + ActiveCount: + metric: active.count + type: gauge + desc: The approximate number of threads that are actively executing tasks. + CompletedTaskCount: + metric: completed.task.count + type: gauge + desc: The approximate total number of tasks that have completed execution. Because the states of tasks and threads may change dynamically during computation, the returned value is only an approximation, but one that does not ever decrease across successive calls. + PoolSize: + metric: pool.size + type: gauge + desc: The current number of threads in the pool. + LargestPoolSize: + metric: largest.pool.size + type: gauge + desc: The largest number of threads that have ever simultaneously been in the pool. + TaskCount: + metric: task.count + type: counter + desc: The approximate total number of tasks that have ever been scheduled for execution. + TaskQueueSize: + metric: task.queue.size + type: gauge + desc: The number of Tasks in the Task Queue diff --git a/instrumentation/jmx-metrics/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/jmx/JmxMetricInsightInstallerTest.java b/instrumentation/jmx-metrics/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/jmx/JmxMetricInsightInstallerTest.java index 0853505ae98b..253583660ddd 100644 --- a/instrumentation/jmx-metrics/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/jmx/JmxMetricInsightInstallerTest.java +++ b/instrumentation/jmx-metrics/javaagent/src/test/java/io/opentelemetry/instrumentation/javaagent/jmx/JmxMetricInsightInstallerTest.java @@ -28,6 +28,7 @@ class JmxMetricInsightInstallerTest { new HashSet<>( Arrays.asList( "activemq.yaml", + "camel.yaml", "hadoop.yaml", "jetty.yaml", "kafka-broker.yaml",