Skip to content

Add async server instrumentation for Apache Thrift 0.13#18994

Merged
trask merged 3 commits into
open-telemetry:mainfrom
YaoYingLong:feature/thrift-0.13
Jun 19, 2026
Merged

Add async server instrumentation for Apache Thrift 0.13#18994
trask merged 3 commits into
open-telemetry:mainfrom
YaoYingLong:feature/thrift-0.13

Conversation

@YaoYingLong

Copy link
Copy Markdown
Contributor

Previously the Thrift 0.13 instrumentation covered async clients and nonblocking sync server processing, but async server handlers using CustomService.AsyncProcessor were not
covered as a server-side async workflow.

This PR adds instrumentation for:

  • org.apache.thrift.TBaseAsyncProcessor#process
  • org.apache.thrift.AsyncProcessFunction#getResultHandler
  • async frame buffer input/output protocol accessors

The test fixture now separates nonblocking sync server startup from true async server startup and adds a CustomAsyncHandler for async server test coverage.

Copilot AI review requested due to automatic review settings June 14, 2026 03:10
@YaoYingLong YaoYingLong requested a review from a team as a code owner June 14, 2026 03:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds end-to-end async server support for Thrift 0.13 instrumentation by decorating nonblocking server protocols, propagating service metadata, and ending server spans at the correct lifecycle points (including async callbacks and one-way requests).

Changes:

  • Introduces an async Thrift test handler and adds javaagent tests covering async server spans (success, many, one-way, error).
  • Adds protocol decoration/caching via VirtualField and new javaagent instrumentations for TBaseAsyncProcessor and AsyncProcessFunction.
  • Updates test utilities to assert server span names by handler class and validate error.type for stable RPC semconv.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
instrumentation/thrift-0.13/testing/src/main/java/io/opentelemetry/instrumentation/thrift/v0_13/CustomAsyncHandler.java Adds async server handler used by new async-server tests.
instrumentation/thrift-0.13/testing/src/main/java/io/opentelemetry/instrumentation/thrift/v0_13/AbstractThriftTest.java Refactors server helpers and expands server span assertions (class name + error.type).
instrumentation/thrift-0.13/library/src/main/java/io/opentelemetry/instrumentation/thrift/v0_13/internal/ServerInProtocolDecorator.java Tracks one-way messages, allows late service-name injection, and de-dupes endSpan().
instrumentation/thrift-0.13/library/src/main/java/io/opentelemetry/instrumentation/thrift/v0_13/internal/AsyncMethodCallbackUtil.java Adds callback wrapper for async server flows to end spans and restore context.
instrumentation/thrift-0.13/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftTest.java Adds javaagent tests validating async server instrumentation behavior.
instrumentation/thrift-0.13/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftTBaseAsyncProcessorInstrumentation.java Sets service name for async server spans and handles one-way/sync-exception end conditions.
instrumentation/thrift-0.13/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftSingletons.java Adds protocol decorator caching to ensure consistent decorator instances per protocol.
instrumentation/thrift-0.13/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftInstrumentationModule.java Registers new async-server instrumentations.
instrumentation/thrift-0.13/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftFrameBufferInstrumentation.java Ensures getInputProtocol/getOutputProtocol return decorated protocols.
instrumentation/thrift-0.13/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/thrift/v0_13/ThriftAsyncProcessFunctionInstrumentation.java Wraps result handler callbacks to end spans for async server workflows.

@trask trask merged commit 2dc5d9f into open-telemetry:main Jun 19, 2026
95 checks passed
@otelbot

otelbot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @YaoYingLong! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants