Search code examples
spring-bootazureopen-telemetryzipkinjaeger

Spring boot actuator traces not sent on azure


I have a Spring Boot 3 application with Spring Boot Actuator that sends micrometer traces via opentelemetry-zipkin exporter to jaeger. The application is baked into a docker container and deployed to Azure Web Apps, jaeger is running in an Azure VM. However, only the first request made by azure (to a robots.txt) seems to create and send traces.

When I run the docker container locally with the same environment variables as on Azure, everything works as expected. I can also verify that the connection to the VM can be made (one, because the first few traces show up, two, because I can open a connection using HttpUrlConnection) but no connection is opened (I checked using tcpdump on the VM). So it seems it's not a cloud-configuration problem, but a problem with the application.

I also noticed that application insights is no longer showing any logging output under traces, so maybe it has something to do with that? However, this also works when running the container locally.

I have run out of ways to debug this and am happy for any ideas how to go about diagnosing the issue.


Solution

  • Turns out, Azure's traceparent header seems to always contain a "not sampled/dropped" value for the sampled flag. Azure documentation with regard to sampling configuration in Java is a bit confusing, so I decided to override the sampler, since I want all the requests to be sampled anyhow.

        @Bean
        fun azureOverridingSampler(): Sampler = Sampler.alwaysOn()
    

    (This is kotlin code, so would have to be adapted for java)