This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch otel
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 96efe1fe31765b4ae8a8b6cee96e6e8b067da74e
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Nov 5 12:33:09 2023 +0100

    CAMEL-20083: camel-opentelemtry - Make it easier to configure for camel-main
---
 .../main/camel-main-configuration-metadata.json     |  4 ++++
 .../src/main/docs/opentelemetry.adoc                | 21 +++++++++++++++++++--
 .../camel/opentelemetry/OpenTelemetryTracer.java    |  4 ++++
 .../META-INF/camel-main-configuration-metadata.json |  2 +-
 core/camel-main/src/main/docs/main.adoc             |  5 ++++-
 .../java/org/apache/camel/main/BaseMainSupport.java |  2 +-
 .../camel/maven/packaging/PrepareCamelMainMojo.java |  2 +-
 7 files changed, 34 insertions(+), 6 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 3235de257b0..3a89ff173c1 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
@@ -10,6 +10,7 @@
     { "name": "camel.vault.aws", "description": "Camel AWS Vault 
configurations", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration" },
     { "name": "camel.vault.gcp", "description": "Camel GCP Vault 
configurations", "sourceType": "org.apache.camel.vault.GcpVaultConfiguration" },
     { "name": "camel.vault.azure", "description": "Camel Azure Key Vault 
configurations", "sourceType": "org.apache.camel.vault.AzureVaultConfiguration" 
},
+    { "name": "camel.opentelemetry", "description": "Camel OpenTelemtry 
configurations", "sourceType": 
"org.apache.camel.main.OtelConfigurationProperties" },
     { "name": "camel.faulttolerance", "description": "Fault Tolerance EIP 
Circuit Breaker configurations", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties" },
     { "name": "camel.resilience4j", "description": "Resilience4j EIP Circuit 
Breaker configurations", "sourceType": 
"org.apache.camel.main.Resilience4jConfigurationProperties" },
     { "name": "camel.lra", "description": "Camel Saga EIP (Long Running 
Actions) configurations", "sourceType": 
"org.apache.camel.main.LraConfigurationProperties" }
@@ -177,6 +178,9 @@
     { "name": "camel.lra.coordinatorUrl", "description": "The URL for the LRA 
coordinator service that orchestrates the transactions", "sourceType": 
"org.apache.camel.main.LraConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
     { "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.opentelemetry.encoding", "description": "Sets whether the 
header keys need to be encoded (connector specific) or not. The value is a 
boolean. Dashes need for instances to be encoded for JMS property keys.", 
"sourceType": "org.apache.camel.main.OtelConfigurationProperties", "type": 
"boolean", "javaType": "boolean", "defaultValue": "false" },
+    { "name": "camel.opentelemetry.excludePatterns", "description": "Adds an 
exclude pattern that will disable tracing for Camel messages that matches the 
pattern. Multiple patterns can be separated by comma.", "sourceType": 
"org.apache.camel.main.OtelConfigurationProperties", "type": "string", 
"javaType": "java.lang.String" },
+    { "name": "camel.opentelemetry.instrumentationName", "description": "A 
name uniquely identifying the instrumentation scope, such as the 
instrumentation library, package, or fully qualified class name. Must not be 
null.", "sourceType": "org.apache.camel.main.OtelConfigurationProperties", 
"type": "string", "javaType": "java.lang.String", "defaultValue": "camel" },
     { "name": 
"camel.resilience4j.automaticTransitionFromOpenToHalfOpenEnabled", 
"description": "Enables automatic transition from OPEN to HALF_OPEN state once 
the waitDurationInOpenState has passed.", "sourceType": 
"org.apache.camel.main.Resilience4jConfigurationProperties", "type": "boolean", 
"javaType": "java.lang.Boolean", "defaultValue": "false" },
     { "name": "camel.resilience4j.bulkheadEnabled", "description": "Whether 
bulkhead is enabled or not on the circuit breaker.", "sourceType": 
"org.apache.camel.main.Resilience4jConfigurationProperties", "type": "boolean", 
"javaType": "java.lang.Boolean", "defaultValue": false },
     { "name": "camel.resilience4j.bulkheadMaxConcurrentCalls", "description": 
"Configures the max amount of concurrent calls the bulkhead will support.", 
"sourceType": "org.apache.camel.main.Resilience4jConfigurationProperties", 
"type": "integer", "javaType": "java.lang.Integer" },
diff --git a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc 
b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
index c61cdd1bde8..c8768469cd2 100644
--- a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
+++ b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
@@ -24,7 +24,7 @@ The configuration properties for the OpenTelemetry tracer are:
 [width="100%",cols="10%,10%,80%",options="header",]
 |=======================================================================
 |Option |Default |Description
-
+|instrumentationName| camel | A name uniquely identifying the instrumentation 
scope, such as the instrumentation library, package, or fully qualified class 
name. Must not be null.
 |excludePatterns |  | Sets exclude pattern(s) that will disable tracing for 
Camel
 messages that matches the pattern. The content is a Set<String> where the key 
is a pattern. The pattern
 uses the rules from Intercept.
@@ -34,7 +34,7 @@ Dashes need for instances to be encoded for JMS property keys.
 |=======================================================================
 
 
-=== Configuration
+== Using Camel OpenTelemetry
 
 Include the `camel-opentelemetry` component in your POM, along with any 
specific dependencies associated with the
 chosen OpenTelemetry compliant Tracer.
@@ -52,6 +52,23 @@ otelTracer.setTracer(...);
 otelTracer.init(camelContext);
 
--------------------------------------------------------------------------------------------------
 
+You would still need OpenTelemetry to instrument your code, which can be done 
via a Java agent (see further below).
+
+=== Using with standalone Camel
+
+If you use `camel-main` as standalone Camel, then you can enable and use 
OpenTelemetry without Java code.
+
+Add `camel-opentelemetry` component in your POM, and configure in 
`application.properties`:
+
+[source,properties]
+----
+camel.opentelemetry.enabled = true
+# you can confiure the other options
+# camel.opentelemetry.instrumentationName = myApp
+----
+
+You would still need OpenTelemetry to instrument your code, which can be done 
via a Java agent (see further below).
+
 == Spring Boot
 
 If you are using Spring Boot then you can add
diff --git 
a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracer.java
 
b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracer.java
index ebacbe6f93f..6858d20e819 100644
--- 
a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracer.java
+++ 
b/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracer.java
@@ -64,6 +64,10 @@ public class OpenTelemetryTracer extends 
org.apache.camel.tracing.Tracer {
         return instrumentationName;
     }
 
+    /**
+     * A name uniquely identifying the instrumentation scope, such as the 
instrumentation library, package, or fully
+     * qualified class name. Must not be null.
+     */
     public void setInstrumentationName(String instrumentationName) {
         this.instrumentationName = instrumentationName;
     }
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 3bad1d9d302..3a89ff173c1 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
@@ -10,7 +10,7 @@
     { "name": "camel.vault.aws", "description": "Camel AWS Vault 
configurations", "sourceType": "org.apache.camel.vault.AwsVaultConfiguration" },
     { "name": "camel.vault.gcp", "description": "Camel GCP Vault 
configurations", "sourceType": "org.apache.camel.vault.GcpVaultConfiguration" },
     { "name": "camel.vault.azure", "description": "Camel Azure Key Vault 
configurations", "sourceType": "org.apache.camel.vault.AzureVaultConfiguration" 
},
-    { "name": "camel.otel", "description": "Camel OpenTelemtry 
configurations", "sourceType": 
"org.apache.camel.main.OtelConfigurationProperties" },
+    { "name": "camel.opentelemetry", "description": "Camel OpenTelemtry 
configurations", "sourceType": 
"org.apache.camel.main.OtelConfigurationProperties" },
     { "name": "camel.faulttolerance", "description": "Fault Tolerance EIP 
Circuit Breaker configurations", "sourceType": 
"org.apache.camel.main.FaultToleranceConfigurationProperties" },
     { "name": "camel.resilience4j", "description": "Resilience4j EIP Circuit 
Breaker configurations", "sourceType": 
"org.apache.camel.main.Resilience4jConfigurationProperties" },
     { "name": "camel.lra", "description": "Camel Saga EIP (Long Running 
Actions) configurations", "sourceType": 
"org.apache.camel.main.LraConfigurationProperties" }
diff --git a/core/camel-main/src/main/docs/main.adoc 
b/core/camel-main/src/main/docs/main.adoc
index 0ffc03e6ce2..3dee56918ae 100644
--- a/core/camel-main/src/main/docs/main.adoc
+++ b/core/camel-main/src/main/docs/main.adoc
@@ -333,11 +333,14 @@ The camel.vault.azure supports 11 options, which are 
listed below.
 
 
 === Camel OpenTelemtry configurations
-The camel.otel supports 0 options, which are listed below.
+The camel.opentelemetry supports 3 options, which are listed below.
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *camel.opentelemetry.encoding* | Sets whether the header keys need to be 
encoded (connector specific) or not. The value is a boolean. Dashes need for 
instances to be encoded for JMS property keys. | false | boolean
+| *camel.opentelemetry.exclude{zwsp}Patterns* | Adds an exclude pattern that 
will disable tracing for Camel messages that matches the pattern. Multiple 
patterns can be separated by comma. |  | String
+| *{zwsp}camel.opentelemetry.instrumentation{zwsp}Name* | A name uniquely 
identifying the instrumentation scope, such as the instrumentation library, 
package, or fully qualified class name. Must not be null. | camel | String
 |===
 
 
diff --git 
a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java 
b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
index f00d66c107e..05944c46592 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java
@@ -57,6 +57,7 @@ import org.apache.camel.spi.AutowiredLifecycleStrategy;
 import org.apache.camel.spi.BacklogDebugger;
 import org.apache.camel.spi.CamelBeanPostProcessor;
 import org.apache.camel.spi.CamelEvent;
+import org.apache.camel.spi.CamelTracingService;
 import org.apache.camel.spi.ContextReloadStrategy;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.Language;
@@ -84,7 +85,6 @@ import org.apache.camel.support.scan.PackageScanHelper;
 import org.apache.camel.support.service.BaseService;
 import org.apache.camel.support.startup.BacklogStartupStepRecorder;
 import org.apache.camel.support.startup.LoggingStartupStepRecorder;
-import org.apache.camel.spi.CamelTracingService;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.OrderedLocationProperties;
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java
index 7d8299bffe9..e5d80ece234 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelMainMojo.java
@@ -319,7 +319,7 @@ public class PrepareCamelMainMojo extends 
AbstractGeneratorMojo {
                             "org.apache.camel.vault.AzureVaultConfiguration"));
             // TODO: add more vault providers here
             model.getGroups().add(new MainGroupModel(
-                    "camel.otel", "Camel OpenTelemtry configurations",
+                    "camel.opentelemetry", "Camel OpenTelemtry configurations",
                     "org.apache.camel.main.OtelConfigurationProperties"));
             model.getGroups()
                     .add(new MainGroupModel(

Reply via email to