Skip to content

Lettuce traces are not attached to a parent context when using telemetry module without Java Agent #15160

@Kresshy

Description

@Kresshy

Describe the bug

We have a manually configured SDK in our services and we added the Lettuce Telemetry module to our codebase to produce traces for Redis queries. The documentation shows it is supported.

We can see the produced spans but it is not attached to an existing parent context. These spans have their own traces with a new trace id, and this is the only span under that trace.

I assume the OTEL context is not propagated to the executor which is used by the lettuce library.

I would like to avoid providing an executor externally where I have to use Context#taskWrapping(Executor) to make this happen and rather rely on the default internal executor of the lettuce library.

Steps to reproduce

  • We are using Java 11 & Lettuce 6.4.0
  • Manually configure OTEL SDK.
  • We use gRPC telemetry as well so our parent spans are usually gRPC traces.
  • Manually initialize LettuceTelemetry and provide it for lettuceClientResources:
lettuceTelemetry = LettuceTelemetry.create(GlobalOpenTelemetry.get());

...
...

clientResourcesBuilder.tracing(lettuceTelemetry.newTracing()).build();
  • When executing Redis queries the produces spans should be attached to the correct parent spans.

Expected behavior

  • The produced spans should be under the correct parent spans/context.

Actual behavior

  • The produced spans are independent, the are not attached to any parents.

Javaagent or library instrumentation version

No java agent, openTelemetryVersion = "1.47.0", openTelemetryInstrumentationVersion = "2.13.1(-alpha)", openTelemetryContribVersion = "1.44.0-alpha"

Environment

JDK: Temurin JDK 11

Additional context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions