Skip to content

Spring Cloud Gateway (with Netty): Otel (Java) auto-instrumentation generates mutiple invalid trace #7497

@ziomill

Description

@ziomill

Describe the bug
I'm using OpenTelemetry auto instrumentation (1.21.0) on a Spring Cloud Gateway instance for trace handling. The Spring Cloud Gateway simply proxies incoming calls to some internal microservices. It happens that, for a single incoming request, two different traces are created at the gateway level. The first is orphaned and is never sent to the proxied microservice. The second is the valid one that is propagated to the called service. On the Jaeger console both traces are visible.

Steps to reproduce
Download the sample and follow the instructions in the READE
https://bitbucket.org/ziomill/otel-springcloudgateway-issue/src/master/

What did you expect to see?
One single trace should be generated for a single request.

What did you see instead?
Two different traces for each request. The first is orphaned and is never sent to the proxied microservice. The second is the valid one.

What version are you using?
OpenTelemetry Java Instrumentation Agent 1.21.0
OpenTelemetry Collector Contrib: 0.68
Spring Cloud Gateway 4.0.0
Spring Boot 3.0.0

Environment
eshop-api-gateway: [dockerized] JDK 17 (Base image: eclipse-temurin:17-jdk-jammy)
users-api: [dockerized] JDK 17 (Base image: eclipse-temurin:17-jdk-jammy)

Additional context
Add any other context about the problem 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