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 f154acb89a5 CAMEL-21387: camel-opentelemetry add some documentation
for Spring Boot (#16094)
f154acb89a5 is described below
commit f154acb89a523b0ccc061e67f7ffb52741fe13c9
Author: John Poth <[email protected]>
AuthorDate: Sun Oct 27 12:31:22 2024 +0100
CAMEL-21387: camel-opentelemetry add some documentation for Spring Boot
(#16094)
---
.../src/main/docs/opentelemetry.adoc | 42 +++++++++++++++++++---
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
index 53d074eff54..ab57c3ceadb 100644
--- a/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
+++ b/components/camel-opentelemetry/src/main/docs/opentelemetry.adoc
@@ -72,12 +72,44 @@ NOTE: You would still need OpenTelemetry to instrument your
code, which can be d
== Spring Boot
-If you are using Spring Boot, then you can add
-the `camel-opentelemetry-starter` dependency, and turn on OpenTelemetry by
annotating
-the main class with `@CamelOpenTelemetry`.
+If you are using Spring Boot, just add
+the `camel-opentelemetry-starter` dependency to get started.
-The `OpenTelemetryTracer` will be implicitly obtained from the camel context's
`Registry`, unless
-a `OpenTelemetryTracer` bean has been defined by the application.
+OpenTelemetry's `Tracer` will be
+https://docs.spring.io/spring-boot/reference/actuator/tracing.html[configured]
through `spring-boot-starter-actuator` unless a `Tracer` is already defined.
+
+*Noteworthy*: by default, Spring Boot samples only 10% of requests to prevent
overwhelming the trace backend.
+Set the property `management.tracing.sampling.probability` to `1.0` if you
want to see all traces.
+
+==== SpanExporters
+
+You'll probably want to configure at least one
https://opentelemetry.io/docs/languages/java/sdk/#spanexporter[SpanExporter]
+as they allow you to export your traces to various backends (e.g Zipkin and
Jaeger) or log them. For example, to export your traces to Jaeger using OTLP
via gRPC,
+add `io.opentelemetry:opentelemetry-exporter-otlp` as a dependency to your
project. To configure it, you can
+use the `management.otlp.tracing` properties or register a new `SpanExporter`
bean yourself:
+
+[source,java]
+--------------------------------------------------------------------------------------------------
+@Bean
+public SpanExporter OtlpGrpcSpanExporter(@Value("${tracing.url}") String url) {
+ return OtlpGrpcSpanExporter.builder().setEndpoint(url).build();
+}
+--------------------------------------------------------------------------------------------------
+
+Spring Boot's Actuator will take care of the wiring for you.
+
+Alternatively if you just want to log your traces in OTLP JSON format,
+add `io.opentelemetry:opentelemetry-exporter-logging-otlp` as a dependency to
your project and also register a new `SpanExporter` bean:
+
+[source,java]
+--------------------------------------------------------------------------------------------------
+@Bean
+public SpanExporter logTraces() {
+ return OtlpJsonLoggingSpanExporter.create();
+}
+--------------------------------------------------------------------------------------------------
+
+Multiple `SpanExporters` can be used at the same time.
[[OpenTelemetry-JavaAgent]]
== Java Agent