-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
bugSomething isn't workingSomething isn't workingneeds author feedbackWaiting for additional feedback from the authorWaiting for additional feedback from the authorneeds triageNew issue that requires triageNew issue that requires triage
Description
Describe the bug
Please help identify why no controller/service spans are being generated, and how to get OpenTelemetry auto-instrumentation working for classic Spring Boot controllers in a Kotlin app.
Steps to reproduce
π Steps to Reproduce
-
Generate Kotlin Spring Boot project
Use [Spring Initializr](https://start.spring.io/) with the following settings:-
Language: Kotlin
-
Spring Boot version: e.g.,
3.2.x -
Dependencies:
Spring Web
-
-
Create a simple controller
@RestController class HelloController { @GetMapping("/hello") fun hello(): String { Thread.sleep(500) // to simulate work and ensure trace is long enough return "Hello from controller" } }
-
Application class
@SpringBootApplication class MyApplication fun main(args: Array<String>) { runApplication<MyApplication>(*args) }
-
Download OpenTelemetry Java agent
curl -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
-
Run the app with the agent with following args
-Dotel.service.name=xxx \ -Dotel.exporter.otlp.endpoint=http://localhost:4317 \ -Dotel.exporter.otlp.protocol=grpc \ -Dotel.metrics.exporter=none \ -Dotel.logs.exporter=none \ -Dotel.instrumentation.spring-web.enabled=true \ -Dotel.instrumentation.spring-webmvc.enabled=true \
-
Trigger the endpoint
curl http://localhost:8080/hello
-
Check for spans
- No spans from controller or service layer appear in OTLP endpoint or logs.
- Agent logs show instrumentations were installed, but no controller traces.
Expected behavior
β What Should Work
- spans/traces from controller layer (e.g.,
@RestController) - spans from service layer (e.g.,
@Service)
Actual behavior
β What Works
- App starts fine with the agent.
- Logs confirm the agent is attached and instrumentation is installed.
- Agent outputs
Installed instrumentations: spring-web, spring-webmvc, etc. - Application responds to HTTP requests.
β What Does NOT Work
- No spans/traces from controller layer (e.g.,
@RestController) - No spans from service layer (e.g.,
@Service) - Tried adding
Thread.sleep()in controller to ensure timing isnβt an issue β no change.
Javaagent or library instrumentation version
latest from the website
Environment
π§© Environment
- Language: Kotlin
- Framework: Spring Boot
- Spring Boot Version: 3.3.4
- OpenTelemetry Java Agent version: Latest (from official site)
- JDK Version: OpenJDK 21.0.1
- App Packaging: Gradle
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds author feedbackWaiting for additional feedback from the authorWaiting for additional feedback from the authorneeds triageNew issue that requires triageNew issue that requires triage