Add auto-instrumentation for Spring MVC handler and @Transactional spans (like Datadog agent)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend, observability
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các điểm tích hợp Spring MVC và giao dịch Spring được nêu trong issue, đặc biệt là HandlerAdapter.handle() và TransactionInterceptor.invoke(), rồi so sánh chúng với module upstream OpenTelemetry Spring MVC instrumentation. Hoàn thành có nghĩa là Java agent tạo các span spring.handler và spring.transaction với ngữ cảnh của phương thức controller hoặc service, đồng thời giữ nguyên waterfall được yêu cầu từ request đến database mà không cần thay đổi ứng dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
When using the Application Insights Java agent (3.7.x) with a Spring Boot application, the transaction waterfall only shows auto-instrumented external calls (JDBC, HTTP clients) but not the internal Spring
framework flow.
The Datadog Java agent, by comparison, automatically creates spans for Spring framework integration points via bytecode instrumentation, producing a detailed waterfall without any code change:
servlet.request (incoming HTTP)
└─ spring.handler (controller method)
└─ spring.transaction (@Transactional service method)
└─ jdbc.query (SQL query via repository)
└─ postgresql.query (driver-level execution)
This is achieved because the Datadog agent instruments Spring MVC handler dispatch and Spring @Transactional boundaries automatically — not every bean method, but the key framework integration points that
give full visibility into the request lifecycle.
With the Application Insights agent, the same request only shows:
GET /api/v1/threads/{id}/messages (request)
└─ SELECT ... FROM message (JDBC)
└─ POST https://openai.azure.com (HTTP)
The entire controller-to-service layer is invisible, making it difficult to identify which business logic step is slow or failing.
Describe the solution you would like
Auto-instrument Spring framework integration points that the Datadog agent already covers, specifically:
- spring.handler — Spring MVC handler method dispatch (the controller method matched by @RequestMapping / @GetMapping / etc.). This span should include the controller class and method name.
- spring.transaction — Spring @Transactional boundaries. This would capture the service-layer method wrapped in a transaction, providing the controller → service link in the waterfall.
These are not arbitrary application methods — they are well-defined framework extension points where Spring already has interceptor/advice infrastructure. The agent could instrument HandlerAdapter.handle()
and TransactionInterceptor.invoke() at the bytecode level, just as it already does for JDBC and HTTP clients.
This would produce the same waterfall visibility that Datadog users get out of the box, without requiring any application code changes, @WithSpan annotations, or customInstrumentation configuration.
Describe alternatives you have considered
- customInstrumentation in applicationinsights.json: Requires listing every class and method individually. Does not scale, is fragile to maintain, and new methods are silently missed. No wildcard or pattern
support is available. - @WithSpan annotations: Requires modifying application code, adds a dependency on opentelemetry-instrumentation-annotations, and must be manually added to every relevant method.
- Spring AOP aspect with ObservationRegistry: A custom @Aspect that wraps all Spring bean methods in Micrometer Observations (bridged to OTel spans via micrometer-tracing-bridge-otel). This works but
requires application-side code, adds spring-boot-starter-aop as a dependency, and introduces AOP proxy overhead. It also instruments more than necessary (every public bean method) since there is no way to
target just framework integration points. - OpenTelemetry Java agent extensions (ByteBuddy): Building a custom InstrumentationModule targeting Spring MVC and Spring TX. However, the Application Insights documentation does not guarantee compatibility
with custom agent extensions.
Additional context
The Datadog Java agent achieves this by instrumenting specific Spring framework classes at the bytecode level:
- HandlerAdapter / DispatcherServlet for spring.handler spans
- PlatformTransactionManager / TransactionInterceptor for spring.transaction spans
These are stable Spring APIs that rarely change between versions. The OpenTelemetry upstream agent already instruments Spring MVC handlers (via spring-webmvc instrumentation module), so the foundation exists
in the OTel ecosystem — it may just need to be enabled or surfaced in the Application Insights distribution.
- Ngôn ngữ chính
- Java
- Star
- 326
- Fork
- 223
- Merge trung bình
- 23 giờ 6 phút
- Pull request đã merge (30 ngày)
- 13
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/ApplicationInsights-Java
-
Java 25 native-access warning from bundled Netty requires broad ALL-UNNAMED permissionCó thể đã có người làm @rajkumar-rangaraj đã nhận 18 ngày trước. Đang mở
microsoft/ApplicationInsights-Java#4851 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
microsoft/ApplicationInsights-Java#4770 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support for tail based sampling?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
microsoft/ApplicationInsights-Java#4769 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoft/ApplicationInsights-Java#4729 · 133 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
microsoft/ApplicationInsights-Java#4712 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/ApplicationInsights-Java
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
bancolombia/scaffold-clean-architecture#1002 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CalendarEventAttendance/get returns eventAttendanceStatus while the doc says attendanceStatusCó thể đã có người làm @chibenwa đã nhận hôm nay. Đang mởbug claude
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
linagora/tmail-backend#2697 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
apache/skywalking#14120 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Case-insensitive search suggestions miss items when the JVM default locale is TurkishCó thể đã có người làm @thswlsqls đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] 关于启动游戏进度条显示的优化Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
HMCL-dev/HMCL#6943 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày