This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 7a4ca4a3749 CAMEL-20105: camel-micromemter - Make it easier to
configure for camel-main
7a4ca4a3749 is described below
commit 7a4ca4a37494906c2e44e5c3c262092695b0a0e8
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 17 11:11:25 2023 +0100
CAMEL-20105: camel-micromemter - Make it easier to configure for camel-main
---
.../main/camel-main-configuration-metadata.json | 2 +-
.../src/main/docs/micrometer-prometheus.adoc | 44 ++++++++--------------
.../micrometer/prometheus/BindersHelper.java | 11 ++++++
.../prometheus/MicrometerPrometheus.java | 5 ++-
.../camel-main-configuration-metadata.json | 2 +-
core/camel-main/src/main/docs/main.adoc | 2 +-
.../camel/main/MetricsConfigurationProperties.java | 24 ++++++------
7 files changed, 45 insertions(+), 45 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
index 6994a0ad04f..8e56959bc3c 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json
@@ -180,7 +180,7 @@
{ "name": "camel.lra.enabled", "description": "To enable Saga LRA",
"sourceType": "org.apache.camel.main.LraConfigurationProperties", "type":
"boolean", "javaType": "boolean", "defaultValue": false },
{ "name": "camel.lra.localParticipantContextPath", "description": "The
context-path for the local participant. Is default \/lra-participant",
"sourceType": "org.apache.camel.main.LraConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "defaultValue": "\/lra-participant" },
{ "name": "camel.lra.localParticipantUrl", "description": "The URL for the
local participant", "sourceType":
"org.apache.camel.main.LraConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
- { "name": "camel.metrics.binders", "description": "Additional Micrometer
binders to include such as jvm-memory, processor, jvm-thread, and so forth.
Multiple binders can be separated by comma. The following binders currently is
available from Micrometer: cache-meter-binder, class-loader,
commons-object-pool2, database-table, disk-space, executor-service,
file-descriptor, hystrix-metrics-binder, jetty-server-thread-pool,
jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info, jvm-memory [...]
+ { "name": "camel.metrics.binders", "description": "Additional Micrometer
binders to include such as jvm-memory, processor, jvm-thread, and so forth.
Multiple binders can be separated by comma. The following binders currently is
available from Micrometer: class-loader, commons-object-pool2, file-descriptor,
hystrix-metrics-binder, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, log4j2, logback, processor, uptime", "sourceType":
"org.apache.camel.main.Metr [...]
{ "name": "camel.metrics.enabled", "description": "To enable Micrometer
metrics.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.metrics.enableExchangeEventNotifier", "description": "Set
whether to enable the MicrometerExchangeEventNotifier for capturing metrics on
exchange processing times.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": true },
{ "name": "camel.metrics.enableMessageHistory", "description": "Set
whether to enable the MicrometerMessageHistoryFactory for capturing metrics on
individual route node processing times. Depending on the number of configured
route nodes, there is the potential to create a large volume of metrics.
Therefore, this option is disabled by default.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
diff --git
a/components/camel-micrometer-prometheus/src/main/docs/micrometer-prometheus.adoc
b/components/camel-micrometer-prometheus/src/main/docs/micrometer-prometheus.adoc
index 747b3b88530..3e46b27ab8c 100644
---
a/components/camel-micrometer-prometheus/src/main/docs/micrometer-prometheus.adoc
+++
b/components/camel-micrometer-prometheus/src/main/docs/micrometer-prometheus.adoc
@@ -35,33 +35,21 @@ camel.metrics.binders=processor,jvm-info,file-descriptor
The following binders can be configured with `camel.metrics.binders` that
comes out of the box from Micrometer:
|====
-|Binder Name
-
-| cache-meter-binder
-| class-loader
-| commons-object-pool2
-| database-table
-| disk-space
-| executor-service
-| file-descriptor
-| hystrix-metrics-binder
-| jetty-server-thread-pool
-| jvm-compilation
-| jvm-gc
-| jvm-heap-pressure
-| jvm-info
-| jvm-memory
-| jvm-thread
-| kafka
-| log4j2
-| logback
-| netty-allocator
-| netty-event-executor
-| ok-http-connection-pool
-| pooling-http-client-connection-manager-metrics-binder
-| postgre-sql-database
-| processor
-| tomcat
-| uptime
+|Binder Name | Description
+
+| class-loader | JVM class loading metrics
+| commons-object-pool2 | Apache Commons Pool 2.x metrics
+| file-descriptor | File descriptor metrics gathered by the JVM
+| hystrix-metrics-binder | Hystrix Circuit Breaker metrics
+| jvm-compilation | JVM compilation metrics
+| jvm-gc | Garbage collection and GC pauses
+| jvm-heap-pressure | Provides methods to access measurements of low pool
memory and heavy GC overhead
+| jvm-info | JVM information
+| jvm-memory | Utilization of various memory and buffer pools.
+| jvm-thread | JVM threads statistics
+| log4j2 | Apache Log4j 2 statistics
+| logback | Logback logger statistics
+| processor | CPU processing statistics
+| uptime | Uptime statistics
|====
\ No newline at end of file
diff --git
a/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/BindersHelper.java
b/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/BindersHelper.java
index 77e07eb0dcb..177f0c679e6 100644
---
a/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/BindersHelper.java
+++
b/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/BindersHelper.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.micrometer.prometheus;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -61,6 +62,16 @@ public final class BindersHelper {
// skip deprecated
continue;
}
+ boolean abs = Modifier.isAbstract(info.flags());
+ if (abs) {
+ // skip abstract
+ continue;
+ }
+ boolean noArg = info.hasNoArgsConstructor();
+ if (!noArg) {
+ // skip binders that need extra configuration
+ continue;
+ }
String name = info.name().local();
if (name.endsWith("Metrics")) {
name = name.substring(0, name.length() - 7);
diff --git
a/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/MicrometerPrometheus.java
b/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/MicrometerPrometheus.java
index caf848ba3f2..6f4e983aae1 100644
---
a/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/MicrometerPrometheus.java
+++
b/components/camel-micrometer-prometheus/src/main/java/org/apache/camel/component/micrometer/prometheus/MicrometerPrometheus.java
@@ -185,8 +185,9 @@ public class MicrometerPrometheus extends ServiceSupport
implements CamelMetrics
* Additional Micrometer binders to include such as jvm-memory, processor,
jvm-thread, and so forth. Multiple
* binders can be separated by comma.
*
- * The following binders currently is available from Micrometer:
- * cache-meter-binder, class-loader, commons-object-pool2, database-table,
disk-space, executor-service, file-descriptor, hystrix-metrics-binder,
jetty-server-thread-pool, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, kafka, log4j2, logback, netty-allocator,
netty-event-executor, ok-http-connection-pool,
pooling-http-client-connection-manager-metrics-binder, postgre-sql-database,
processor, tomcat, uptime
+ * The following binders currently is available from Micrometer:
class-loader, commons-object-pool2,
+ * file-descriptor, hystrix-metrics-binder, jvm-compilation, jvm-gc,
jvm-heap-pressure, jvm-info, jvm-memory,
+ * jvm-thread, log4j2, logback, processor, uptime
*/
public void setBinders(String binders) {
this.binders = binders;
diff --git
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
index 6994a0ad04f..8e56959bc3c 100644
---
a/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
+++
b/core/camel-main/src/generated/resources/META-INF/camel-main-configuration-metadata.json
@@ -180,7 +180,7 @@
{ "name": "camel.lra.enabled", "description": "To enable Saga LRA",
"sourceType": "org.apache.camel.main.LraConfigurationProperties", "type":
"boolean", "javaType": "boolean", "defaultValue": false },
{ "name": "camel.lra.localParticipantContextPath", "description": "The
context-path for the local participant. Is default \/lra-participant",
"sourceType": "org.apache.camel.main.LraConfigurationProperties", "type":
"string", "javaType": "java.lang.String", "defaultValue": "\/lra-participant" },
{ "name": "camel.lra.localParticipantUrl", "description": "The URL for the
local participant", "sourceType":
"org.apache.camel.main.LraConfigurationProperties", "type": "string",
"javaType": "java.lang.String" },
- { "name": "camel.metrics.binders", "description": "Additional Micrometer
binders to include such as jvm-memory, processor, jvm-thread, and so forth.
Multiple binders can be separated by comma. The following binders currently is
available from Micrometer: cache-meter-binder, class-loader,
commons-object-pool2, database-table, disk-space, executor-service,
file-descriptor, hystrix-metrics-binder, jetty-server-thread-pool,
jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info, jvm-memory [...]
+ { "name": "camel.metrics.binders", "description": "Additional Micrometer
binders to include such as jvm-memory, processor, jvm-thread, and so forth.
Multiple binders can be separated by comma. The following binders currently is
available from Micrometer: class-loader, commons-object-pool2, file-descriptor,
hystrix-metrics-binder, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, log4j2, logback, processor, uptime", "sourceType":
"org.apache.camel.main.Metr [...]
{ "name": "camel.metrics.enabled", "description": "To enable Micrometer
metrics.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
{ "name": "camel.metrics.enableExchangeEventNotifier", "description": "Set
whether to enable the MicrometerExchangeEventNotifier for capturing metrics on
exchange processing times.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": true },
{ "name": "camel.metrics.enableMessageHistory", "description": "Set
whether to enable the MicrometerMessageHistoryFactory for capturing metrics on
individual route node processing times. Depending on the number of configured
route nodes, there is the potential to create a large volume of metrics.
Therefore, this option is disabled by default.", "sourceType":
"org.apache.camel.main.MetricsConfigurationProperties", "type": "boolean",
"javaType": "boolean", "defaultValue": "false" },
diff --git a/core/camel-main/src/main/docs/main.adoc
b/core/camel-main/src/main/docs/main.adoc
index d92a3928706..6fc77d2bfd6 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -352,7 +352,7 @@ The camel.metrics supports 8 options, which are listed
below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *camel.metrics.binders* | Additional Micrometer binders to include such as
jvm-memory, processor, jvm-thread, and so forth. Multiple binders can be
separated by comma. The following binders currently is available from
Micrometer: cache-meter-binder, class-loader, commons-object-pool2,
database-table, disk-space, executor-service, file-descriptor,
hystrix-metrics-binder, jetty-server-thread-pool, jvm-compilation, jvm-gc,
jvm-heap-pressure, jvm-info, jvm-memory, jvm-thread, kafka, log4j2 [...]
+| *camel.metrics.binders* | Additional Micrometer binders to include such as
jvm-memory, processor, jvm-thread, and so forth. Multiple binders can be
separated by comma. The following binders currently is available from
Micrometer: class-loader, commons-object-pool2, file-descriptor,
hystrix-metrics-binder, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, log4j2, logback, processor, uptime | | String
| *camel.metrics.enabled* | To enable Micrometer metrics. | false | boolean
| *camel.metrics.enableExchange{zwsp}EventNotifier* | Set whether to enable
the MicrometerExchangeEventNotifier for capturing metrics on exchange
processing times. | true | boolean
| *camel.metrics.enableMessage{zwsp}History* | Set whether to enable the
MicrometerMessageHistoryFactory for capturing metrics on individual route node
processing times. Depending on the number of configured route nodes, there is
the potential to create a large volume of metrics. Therefore, this option is
disabled by default. | false | boolean
diff --git
a/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java
b/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java
index 62d547b63cb..f5c7772149c 100644
---
a/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java
+++
b/core/camel-main/src/main/java/org/apache/camel/main/MetricsConfigurationProperties.java
@@ -69,8 +69,7 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
/**
* Controls the name style to use for metrics.
*
- * Default = uses micrometer naming convention.
- * Legacy = uses the classic naming style (camelCase)
+ * Default = uses micrometer naming convention. Legacy = uses the classic
naming style (camelCase)
*/
public void setNamingStrategy(String namingStrategy) {
this.namingStrategy = namingStrategy;
@@ -132,8 +131,8 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
/**
* The text-format version to use with Prometheus scraping.
*
- * 0.0.4 = text/plain; version=0.0.4; charset=utf-8
- * 1.0.0 = application/openmetrics-text; version=1.0.0; charset=utf-8
+ * 0.0.4 = text/plain; version=0.0.4; charset=utf-8 1.0.0 =
application/openmetrics-text; version=1.0.0;
+ * charset=utf-8
*/
public void setTextFormatVersion(String textFormatVersion) {
this.textFormatVersion = textFormatVersion;
@@ -147,8 +146,9 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
* Additional Micrometer binders to include such as jvm-memory, processor,
jvm-thread, and so forth. Multiple
* binders can be separated by comma.
*
- * The following binders currently is available from Micrometer:
- * cache-meter-binder, class-loader, commons-object-pool2, database-table,
disk-space, executor-service, file-descriptor, hystrix-metrics-binder,
jetty-server-thread-pool, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, kafka, log4j2, logback, netty-allocator,
netty-event-executor, ok-http-connection-pool,
pooling-http-client-connection-manager-metrics-binder, postgre-sql-database,
processor, tomcat, uptime
+ * The following binders currently is available from Micrometer:
class-loader, commons-object-pool2,
+ * file-descriptor, hystrix-metrics-binder, jvm-compilation, jvm-gc,
jvm-heap-pressure, jvm-info, jvm-memory,
+ * jvm-thread, log4j2, logback, processor, uptime
*/
public void setBinders(String binders) {
this.binders = binders;
@@ -178,8 +178,7 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
/**
* Controls the name style to use for metrics.
*
- * Default = uses micrometer naming convention.
- * Legacy = uses the classic naming style (camelCase)
+ * Default = uses micrometer naming convention. Legacy = uses the classic
naming style (camelCase)
*/
public MetricsConfigurationProperties withNamingStrategy(String
namingStrategy) {
this.namingStrategy = namingStrategy;
@@ -218,8 +217,8 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
/**
* The text-format version to use with Prometheus scraping.
*
- * 0.0.4 = text/plain; version=0.0.4; charset=utf-8
- * 1.0.0 = application/openmetrics-text; version=1.0.0; charset=utf-8
+ * 0.0.4 = text/plain; version=0.0.4; charset=utf-8 1.0.0 =
application/openmetrics-text; version=1.0.0;
+ * charset=utf-8
*/
public MetricsConfigurationProperties withTextFormatVersion(String
textFormatVersion) {
this.textFormatVersion = textFormatVersion;
@@ -230,8 +229,9 @@ public class MetricsConfigurationProperties implements
BootstrapCloseable {
* Additional Micrometer binders to include such as jvm-memory, processor,
jvm-thread, and so forth. Multiple
* binders can be separated by comma.
*
- * The following binders currently is available from Micrometer:
- * cache-meter-binder, class-loader, commons-object-pool2, database-table,
disk-space, executor-service, file-descriptor, hystrix-metrics-binder,
jetty-server-thread-pool, jvm-compilation, jvm-gc, jvm-heap-pressure, jvm-info,
jvm-memory, jvm-thread, kafka, log4j2, logback, netty-allocator,
netty-event-executor, ok-http-connection-pool,
pooling-http-client-connection-manager-metrics-binder, postgre-sql-database,
processor, tomcat, uptime
+ * The following binders currently is available from Micrometer:
class-loader, commons-object-pool2,
+ * file-descriptor, hystrix-metrics-binder, jvm-compilation, jvm-gc,
jvm-heap-pressure, jvm-info, jvm-memory,
+ * jvm-thread, log4j2, logback, processor, uptime
*/
public MetricsConfigurationProperties withBinders(String binders) {
this.binders = binders;