Add auto-instrumentation for Spring MVC handler and @Transactional spans (like Datadog agent)
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- backend, observability
調査の方向性
まず、issue で挙げられている Spring MVC と Spring トランザクションの統合ポイント、特に HandlerAdapter.handle() と TransactionInterceptor.invoke() を確認し、upstream の OpenTelemetry Spring MVC instrumentation module と比較してください。Java agent がコントローラーまたはサービスメソッドのコンテキストを含む spring.handler span と spring.transaction span を作成し、アプリケーションを変更せずに要求されたリクエストからデータベースまでの waterfall を維持できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 327
- フォーク
- 222
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 12
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/ApplicationInsights-Java のほかの issue
-
Java 25 native-access warning from bundled Netty requires broad ALL-UNNAMED permission対応中かも @rajkumar-rangaraj が 13 日前に担当しました。 オープン
microsoft/ApplicationInsights-Java#4851 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
microsoft/ApplicationInsights-Java#4817 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
microsoft/ApplicationInsights-Java#4770 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
microsoft/ApplicationInsights-Java#4769 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
microsoft/ApplicationInsights-Java#4729 · コメント 127 件 ·
メンテナーはふだん 2 日以内に返信
microsoft/ApplicationInsights-Java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Content
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
RunestoneInteractive/rs#1559 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
inu-appcenter/memorIN-backend#298 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
opendataloader-project/opendataloader-pdf#757 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
redhat-developer/intellij-quarkus#1626 ·