# OpenTelemetry Setup for the new Akka Java SDK

**URL:** <https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663>\
**Category:** Akka Libraries\
**Tags:** java\
**Created:** [August 25, 2025, 10:45am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663 "2025-08-25T10:45:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 25, 2025, 10:45am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/1 "2025-08-25T10:45:08Z")

</div>

As per the docs, here’s how I setup my SDK:

```auto
akka.javasdk {
  agent {
    model-provider = openai

    openai {
      model-name = "gpt-4o-mini"
      api-key = ${?OPENAI_API_KEY}
    }
  }

  telemetry {
    tracing {
      collector-endpoint = "http://localhost:4317"
      collector-endpoint = ${?COLLECTOR_ENDPOINT}
    }
  }
}

```

This seems to work in that I can see some spans running in jaeger as the image shows:

 ![Screenshot 2025-08-25 at 8.43.55 pm](https://us1.discourse-cdn.com/flex020/uploads/discuss_lightbend/original/2X/c/cc2f37d28dd0931c5cc010aa344c63b1190affc1.png)

But as you can also see, the actual arguments to the call to OpenAI aren’t shown at all in the traces.

Perhaps I’m missing something?

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [August 25, 2025, 3:48pm UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/2 "2025-08-25T15:48:28Z")

</div>

We are actively working on the tracing right now, so it is possible that this improved with the just released SDK 3.5.1. However I don’t think we currently include the raw request sent to the model either. I’m not sure the future plan is to generally include it in the otel traces, but there are a lot of improvements around inspection of requests coming up.

For the record this is what the jaeger trace of a request using the helloworld-agent looks like on my machine (SDK 3.5.1):

 ![Screenshot 2025-08-25 at 17.44.13](https://us1.discourse-cdn.com/flex020/uploads/discuss_lightbend/original/2X/a/aad1aad369514ee6339c7424153b1108ce07229e.jpeg)

---

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 26, 2025, 3:12am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/3 "2025-08-26T03:12:36Z")

</div>

Thanks for sharing. I tried upgrading to 3.5.1 but it still doesn’t give me that level of insight - I’m still getting the same traces as before.

Are you able to share how you configured OTEL and Jaeger? Beyond the application.conf I shared above, I also have these environment variables set:

`export JAVA_TOOL_OPTIONS=“-javaagent:./opentelemetry-javaagent.jar”`  
`export OTEL_SERVICE_NAME=shallow-research`  
`export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`  
`export OTEL_LOGS_EXPORTER=none`  
`export OTEL_EXPORTER_OTLP_ENABLED=true`  
`export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`

Also worth mentioning my application is a multi-agent workflow, in case it matters.

---

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 26, 2025, 4:57am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/4 "2025-08-26T04:57:46Z")

</div>

In addition, to rule out other issues, I cloned the repo for the helloworld-agent and added the opentelemetry javaagent to it. The issue is reproducible that way.

So it seems it has to do with the auto instrumentation provided by the agent. How did you set yours up?

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [August 26, 2025, 6:00am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/5 "2025-08-26T06:00:23Z")

</div>

The intent with the tracing support in Akka SDK is not to use an otel agent at all, the otel instrumentation is provided out of the box without the agent. I guess if running with the agent it must be overriding the traces that the SDK and runtime is collecting.

---

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 26, 2025, 6:38am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/6 "2025-08-26T06:38:05Z")

</div>

I’ve tried not using the agent. In that case, do you simply run it with `mvn compile exec:java` ?

No additional configuration needed? When I remove the Java agent, nothing seems to get sent to Jaeger.

---

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 26, 2025, 7:09am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/7 "2025-08-26T07:09:30Z")

</div>

Ok this was user error! My bad!

Turns out I was using the wrong environment variable to enable tracing: `TELEMETRY_ENABLED` which is incorrect (I’m not sure where I read that).

If I remove the java agent and instead use `TRACING_ENABLED` I get the results I was expecting.

Thank you, I’m good to go for now!

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [August 26, 2025, 7:59am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/8 "2025-08-26T07:59:11Z")

</div>

Sorry, I should have been more clear about that, just like you figured out, to get local tracing enabled the service needs to be started as described in the “tracing” sample readme, with the TRACING\_ENABLED like so:

```auto
TRACING_ENABLED=true mvn compile exec:java

```

---

<div class="post-metadata">

**Author:** ![theleoborges](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/theleoborges/32/3278_2.png) [@theleoborges](https://discuss.akka.io/u/theleoborges)\
**Post date:** [August 26, 2025, 8:45am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/9 "2025-08-26T08:45:54Z")

</div>

Yup. that is working!

Another question - part of why I went through this setup is to send LLM metrics to Langfuse ([https://langfuse.com/](https://langfuse.com/))

Turns out their OTel endpoint doesn’t support gRPC, so I have configured the protocol as follows:  
`export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`

Yet, when I run the application, I get these errors:

`Aug 26, 2025 5:47:55 PM io.opentelemetry.sdk.internal.ThrottlingLogger doLog`  
`WARNING: Failed to export spans. Server responded with gRPC status code 2. Error message:`

From some googling this seems to indicate that OTel is still trying to use grpc, but I’m unsure. Have you seen this previously?

---

<div class="post-metadata">

**Author:** ![johanandren](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/johanandren/32/85_2.png) [@johanandren](https://discuss.akka.io/u/johanandren)\
**Post date:** [August 26, 2025, 9:31am UTC](https://discuss.akka.io/t/opentelemetry-setup-for-the-new-akka-java-sdk/11663/10 "2025-08-26T09:31:26Z")

</div>

I haven’t seen anything like that no, but I’m pretty sure such environment variables will are not picked up anywhere and the runtime is more or less hard coded to use gRPC for the metrics and tracing.

Note that we have really not intended that type of configuration for the tracing, it’s optimized for the platform deployment and eventually also the local console. I think it will also move further in that less flexible, but providing more things out of the box, direction with work we are doing right now.
