This is an automated email from the ASF dual-hosted git repository.
Croway pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new 0e7293fab02 chore(starters): enable camel metric
record-last-exchange-timestamp (#2069)
0e7293fab02 is described below
commit 0e7293fab029d7e8efe3fbe70549a3e748d31f9a
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Wed Nov 4 10:33:58 2026 +0100
chore(starters): enable camel metric record-last-exchange-timestamp (#2069)
---
.../camel-micrometer-starter/src/main/docs/micrometer.json | 7 +++++++
.../springboot/metrics/CamelMetricsAutoConfiguration.java | 1 +
.../springboot/metrics/CamelMetricsConfiguration.java | 14 ++++++++++++++
.../modules/ROOT/pages/starters/micrometer.adoc | 3 ++-
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git
a/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
b/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
index 4a38a059883..7fc6f8e204c 100644
--- a/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
+++ b/components-starter/camel-micrometer-starter/src/main/docs/micrometer.json
@@ -117,6 +117,13 @@
"sourceType":
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration",
"defaultValue": "default"
},
+ {
+ "name": "camel.metrics.record-last-exchange-timestamp",
+ "type": "java.lang.Boolean",
+ "description": "Set whether to record the timestamp of the last exchange
as a metric for the exchange event notifier (default, `true`).",
+ "sourceType":
"org.apache.camel.component.micrometer.springboot.metrics.CamelMetricsConfiguration",
+ "defaultValue": true
+ },
{
"name": "camel.metrics.route-policy-exclude-pattern",
"type": "java.lang.String",
diff --git
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
index daec6968df3..24ad2a9bb3a 100644
---
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
+++
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsAutoConfiguration.java
@@ -76,6 +76,7 @@ public class CamelMetricsAutoConfiguration {
notifier.setCamelContext(camelContext);
notifier.setMeterRegistry(meterRegistry);
notifier.setLogMetricsOnShutdown(configuration.isLogMetricsOnShutdown());
+
notifier.setRecordLastExchangeTimestamp(configuration.isRecordLastExchangeTimestamp());
if (configuration.getLogMetricsOnShutdownFilters() != null){
String[] shutdownFilters =
configuration.getLogMetricsOnShutdownFilters().split(",");
notifier.setLogMetricsOnShutdownFilters(shutdownFilters);
diff --git
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
index 62a8df3fa3e..68ce75aae23 100644
---
a/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
+++
b/components-starter/camel-micrometer-starter/src/main/java/org/apache/camel/component/micrometer/springboot/metrics/CamelMetricsConfiguration.java
@@ -112,6 +112,12 @@ public class CamelMetricsConfiguration {
*/
private String logMetricsOnShutdownFormat;
+ /**
+ * Set whether to record the timestamp of the last exchange as a metric
for the exchange event
+ * notifier (default, `true`).
+ */
+ private boolean recordLastExchangeTimestamp = true;
+
public boolean isUriTagEnabled() {
return uriTagEnabled;
}
@@ -223,4 +229,12 @@ public class CamelMetricsConfiguration {
public void setLogMetricsOnShutdownFormat(String
logMetricsOnShutdownFormat) {
this.logMetricsOnShutdownFormat = logMetricsOnShutdownFormat;
}
+
+ public boolean isRecordLastExchangeTimestamp() {
+ return recordLastExchangeTimestamp;
+ }
+
+ public void setRecordLastExchangeTimestamp(boolean
recordLastExchangeTimestamp) {
+ this.recordLastExchangeTimestamp = recordLastExchangeTimestamp;
+ }
}
diff --git a/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
b/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
index 06b08147ce0..f46dd1cdaef 100644
--- a/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
+++ b/docs/spring-boot/modules/ROOT/pages/starters/micrometer.adoc
@@ -23,7 +23,7 @@ Please refer to the above links for usage and configuration
details.
== Spring Boot Auto-Configuration
-The starter supports 18 options, which are listed below.
+The starter supports 19 options, which are listed below.
[width="100%",cols="2,5,^1,2",options="header"]
|===
@@ -42,6 +42,7 @@ The starter supports 18 options, which are listed below.
| camel.metrics.log-metrics-on-shutdown-filters | List of metrics (comma
separated) to log when application is shutting down. You can use a wildcard to
log any metrics matching a pattern, for example `camel.exchanges.*` (default to
all metrics available). | | String
| camel.metrics.log-metrics-on-shutdown-format | Format used to log metrics
when application is shutting down. Either json (default) or prometheus format.
| | String
| camel.metrics.naming-strategy | Controls the name style to use for metrics.
Default = uses micrometer naming convention. Legacy = uses the classic naming
style (camelCase) | default | String
+| camel.metrics.record-last-exchange-timestamp | Set whether to record the
timestamp of the last exchange as a metric for the exchange event notifier
(default, `true`). | true | Boolean
| camel.metrics.route-policy-exclude-pattern | Pattern to exclude routes (by
id) to capture. Multiple route ids can be separated by comma. | | String
| camel.metrics.route-policy-level | Sets the level of information to capture.
Possible values are all,route,context. all = both context and routes. route =
routes only. context = camel context only. | all | String
| camel.metrics.uri-tag-dynamic | Whether to use static or dynamic values for
HTTP uri tags in captured metrics. When using dynamic tags, then a REST service
with base URL: /users/\{id} will capture metrics with uri tag with the actual
dynamic value such as: /users/123. However, this can lead to many tags as the
URI is dynamic, so use this with care. The dynamic value is only used for
requests that are resolved to a Camel HTTP consumer, any other request is
tagged by the default Spring c [...]