2

I have spring-boot application and it has the next dependencies:

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation "com.datadoghq:dd-java-agent:0.75.0"
annotationProcessor "com.datadoghq:dd-java-agent:0.75.0"
testImplementation 'org.springframework.boot:spring-boot-starter-test'}

bootRun {
   jvmArgs = ["-javaagent:" + configurations.runtimeClasspath.files.find { f -> f.path.contains('dd-java-agent') }.path]
}

I execute Datadog agent in the container and configure it there(KEY, ENV).

When I use API from dd-trace (like datadog.trace.api.Trace), I can see traces in Datadog. But when I use sleuth API to create spans/tags/events I cant see traces.

Is it possible to use sleuth API to send traces to Datadog via Datadog agent? If yes, what do I need to do for it?

sergio
  • 23
  • 1
  • 3

1 Answers1

2

Spring Cloud Sleuth supports two tracing libraries:

  • Brave: the tracing lib of OpenZipkin (Sleuth uses this by default)
  • OpenTelemetry: you need to add Sleuth-OTel but it is in incubator so not recommended in production, also OpenTelemetry Java is still in alpha

There are a few things you can do:

Jonatan Ivanov
  • 4,895
  • 2
  • 15
  • 30
  • Thank you, @Jonatan Ivanov! I was able to send traces over setting Sleuth+Zipkin to OTel collector(DataDog exporter). But when I try to use Sleuth-OTel, it does not send traces to OTel collector. I see some error in the log: **[nio-8080-exec-3] t.p.B3PropagatorExtractorMultipleHeaders : Invalid TraceId in B3 header: null'. Returning INVALID span context.** Also is it possible to send with Sleuth-OTel java Metrics? – sergio Jun 09 '21 at 15:38
  • @sergio Based on this, I don't really know what is the issue, you can check the Sleuth-OTel samples, they should work. Please also notice that we don't recommend using Sleuth-OTel in production (see above: it's not stable yet because of OTel is not stable yet). Sleuth is a distributed tracing library, it does not support metrics. Micrometer is the library that you can use to record and ship metrics. OTel Metrics does not even have a released specification so you will not be able to use it at the moment. – Jonatan Ivanov Jun 10 '21 at 14:50