Skip to content

Spring Gateway - only requests to the gateway generates spans #10648

Open
@florenciazabala

Description

@florenciazabala

Describe the bug

As is explained in this issue I've tried to use manual auto-implementation in a Spring Cloud Gateway API, when a request is made to the Gateway a span is generated correctly but I expect the requests to downstream services also generates a span.

Steps to reproduce

1- Add the following dependencies

 <dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
        <version>4.1.1</version>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry.instrumentation</groupId>
        <artifactId>opentelemetry-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>io.opentelemetry.instrumentation</groupId>
        <artifactId>opentelemetry-spring-webflux-5.3</artifactId>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-bom</artifactId>
            <version>1.34.1</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry.instrumentation</groupId>
            <artifactId>opentelemetry-instrumentation-bom-alpha</artifactId>
            <version>2.0.0-alpha</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

2- Add the next code:

  @Bean
    WebFilter telemetryFilter(OpenTelemetry openTelemetry) {
        return SpringWebfluxTelemetry.builder(openTelemetry)
                .build()
                .createWebFilterAndRegisterReactorHook();
    }

Here is a basic example: https://github.com/florenciazabala/otel-spring-gateway

Expected behavior

All requests should generate spans. I expect at least the request to the gateway api and the request to de core api generates spans.

Actual behavior

Only requests to the gateway generate a span.

image

Javaagent or library instrumentation version

opentelemetry-spring-boot-starter v2.0.0-alpha

Environment

JDK: 21

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions