spring-cloud-sleuth-otel
spring-cloud-sleuth-otel copied to clipboard
Improve docs around configuration
Describe the bug I finally got Spring Cloud Sleuth Otel running (I think). In my use case, I want to configure Spring Cloud Sleuth Otel to export traces to an OpenTelemetry Collector via the OTel exporter:
spring:
sleuth:
otel:
exporter:
otlp:
endpoint: http://collector
The app starts up fine, but the exporter wasn't configured. Only after digging in the code did I find out that I had to add these two dependencies to make it work:
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp-trace</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-okhttp</artifactId>
<version>1.42.1</version>
</dependency>
Only then was the exporter added to the application context and started working.
It would be great if the docs would contain a section about how to configure the different exporters.
Maybe even add some check that stops the app from starting when an exporter is configured in application.yml, but is missing certain beans in the application context to work?
Sample An app running with the above configuration is available here: https://github.com/thombergs/sleuth-otel
Great, are you willing to file a PR ? :)
I'm certainly willing but may not find the time (as usual) :). But I'm currently writing a blog post about a setup with an OpenTelemetry Collector and Logz.io, so there is probably some synergy here.
Hi @thombergs ,
thanks, I was also facing the same issue but after adding these dependencies and configuration it is working.
I have another issue. Can you please help? For demo i have installed jaeger using docker.
collector:
image: jaegertracing/opentelemetry-all-in-one
ports:
- 5775:5775/udp
- 6831:6831/udp
- 6832:6832/udp
- 5778:5778
- 16686:16686
- 14268:14268
- 14250:14250
- 4317:4317
- 9411:9411
In application i have configured
spring:
output:
ansi:
enabled: always
application:
name: api-service
sleuth:
otel:
exporter:
otlp:
endpoint: http://collector:4317
But came to know that jaegertracing/opentelemetry-all-in-one is discontinued image and i have to use jaegertracing/all-in-one docker image.
As per the instruction on this https://www.jaegertracing.io/docs/1.34/getting-started/#all-in-one page below are the ports.
-p 5775:5775/udp
-p 6831:6831/udp
-p 6832:6832/udp
-p 5778:5778
-p 16686:16686
-p 14250:14250
-p 14268:14268
-p 14269:14269
-p 9411:9411 \
which port should i have to configure in my application now?
I don't think this is at all related to Sleuth. Please ask it in the Jaeger repo.
Sure but wondering if i have to use different protocol other than OTLP then what i have to configure in my app properties. Do you have any ref doc?
I am referring Jaeger doc https://www.jaegertracing.io/docs/1.34/getting-started/#all-in-one.
| Port | Protocol | Component | Function |
|---|---|---|---|
| 5775 | UDP | agent | accept zipkin.thrift over compact thrift protocol (deprecated, used by legacy clients only) |
| 6831 | UDP | agent | accept jaeger.thrift over compact thrift protocol |
| 6832 | UDP | agent | accept jaeger.thrift over binary thrift protocol |
Does spring cloud sleuth supports exporting/sending trace data over UDP protocol?
https://github.com/spring-projects-experimental/spring-cloud-sleuth-otel/blob/main/spring-cloud-sleuth-otel-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/otel/OtelExporterConfiguration.java I'm not an expert in Jaeger but you can register your own JaegerGrpcSpanExporter if it allows you to set different protocols.
Sleuth reached the end of its OSS support timeline. We encourage to migrate to Micrometer Tracing.