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-spring-boot-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 9dd0c3b  CAMEL-19136: camel-micrometer-starter - Turn of metrics with 
uri tag by default as it can lead to too many tags due to dynamic values.
9dd0c3b is described below

commit 9dd0c3b5ec3668ead4bebe3a0ddbde95fb7636eb
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sat Mar 18 12:01:23 2023 +0100

    CAMEL-19136: camel-micrometer-starter - Turn of metrics with uri tag by 
default as it can lead to too many tags due to dynamic values.
---
 rest-openapi/README.adoc                               |  4 ++++
 rest-openapi/pom.xml                                   | 17 ++++++++++++++++-
 rest-openapi/src/main/resources/application.properties | 10 ++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/rest-openapi/README.adoc b/rest-openapi/README.adoc
index 7b558b3..bf74d54 100644
--- a/rest-openapi/README.adoc
+++ b/rest-openapi/README.adoc
@@ -75,6 +75,10 @@ $ curl http://localhost:8080/api/api-doc
 
 The Spring Boot application can be stopped pressing `[CTRL] + [C]` in the 
shell.
 
+=== Actuator
+
+The actuator is available at: `http://localhost:8080/actuator/` such as 
metrics for Prometheus: `http://localhost:8080/actuator/prometheus`.
+
 === Help and contributions
 
 If you hit any problem using Camel or have some feedback, then please
diff --git a/rest-openapi/pom.xml b/rest-openapi/pom.xml
index 6a0a977..6b31a78 100644
--- a/rest-openapi/pom.xml
+++ b/rest-openapi/pom.xml
@@ -16,7 +16,8 @@
     limitations under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -82,6 +83,20 @@
             <artifactId>commons-lang3</artifactId>
         </dependency>
 
+        <!-- metrics and expose for prometheus -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-micrometer-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.micrometer</groupId>
+            <artifactId>micrometer-registry-prometheus</artifactId>
+        </dependency>
+
         <!-- Test -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
diff --git a/rest-openapi/src/main/resources/application.properties 
b/rest-openapi/src/main/resources/application.properties
index 20829a9..5923779 100644
--- a/rest-openapi/src/main/resources/application.properties
+++ b/rest-openapi/src/main/resources/application.properties
@@ -39,3 +39,13 @@ camel.servlet.mapping.context-path=/api/*
 #logging.level.org.springframework = INFO
 #logging.level.org.apache.camel.spring.boot = INFO
 #logging.level.org.apache.camel.impl = DEBUG
+
+# enable metrics
+management.metrics.enable.all=false
+management.metrics.enable.jvm=false
+management.metrics.enable.http=true
+management.endpoints.web.exposure.include=mappings,metrics,shutdown,prometheus
+
+# camel metrics can be configured
+# beware if you have a lot of dynamic uris then turn this off
+camel.metrics.uriTagEnabled = true

Reply via email to