docs: document the internal APIs that the OpenTelemetry agent instruments - #3473
Merged
pjfanning merged 1 commit intoAug 28, 2026
Merged
Conversation
…ents Motivation: The OpenTelemetry Java agent propagates trace context through pekko actors, streams and remoting by attaching bytecode advice to specific internal methods. Its muzzle checks verify the classes the advice code calls, not the method matchers, so renaming, inlining or restructuring a matched method silently stops context propagation with no error and no log. Modification: Document the matched methods where they are declared, naming the agent, saying what it uses the method for and linking to the instrumentation source. Mark them `@noinline` so the compiler cannot inline them out of the bytecode. List the RemoteInstrument identifiers known to be taken by other projects so that the next implementer can pick a free one. No API changes. Result: The load-bearing internal APIs are recorded next to the code, and new InstrumentationPointsSpec suites fail loudly if a matched name, arity or parameter type disappears from the bytecode. Tests: - sbt "actor-tests/testOnly org.apache.pekko.dispatch.InstrumentationPointsSpec" - 6 passed - sbt "stream-tests/testOnly org.apache.pekko.stream.impl.fusing.InstrumentationPointsSpec" - 1 passed - sbt "remote/testOnly org.apache.pekko.remote.InstrumentationPointsSpec" - 10 passed - sbt actor/mimaReportBinaryIssues stream/mimaReportBinaryIssues remote/mimaReportBinaryIssues - clean - sbt scalafmtCheckAll scalafmtSbtCheck - pass - sbt headerCreateAll - headers added for the three new files References: Fixes apache#3472, Refs apache/pekko-http#1240, Refs open-telemetry/opentelemetry-java-instrumentation#19823
He-Pin
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The OpenTelemetry Java agent propagates trace context through pekko actors, streams and remoting by attaching bytecode advice to specific internal methods. Its muzzle checks verify the classes and methods the advice code calls, not the method matchers, so a matched method that is renamed, inlined or restructured just stops matching — no error, no log, silently broken propagation.
This is the pekko-core counterpart of apache/pekko-http#1240, which does the same for pekko-http.
Modification
@noinlineso the compiler cannot inline them out of the bytecode, following the existing precedent inEnvelope.copy,MessageBufferandDispatch.stop.RemoteInstrument.identifiervalues known to be taken (0 Lightbend Telemetry, 1 Pekko's ownLoggingRemoteInstrument, 8 Kamon, 9 OpenTelemetry) so the next implementer does not have to grep other projects for a free one.No API changes, no
@InternalStableApiadded.Documented symbols:
Dispatcher.dispatch,ActorCell.invoke,ActorCell.systemInvoke,DefaultSystemMessageQueue.systemEnqueue,LightArrayRevolverScheduler.schedule/scheduleOnceGraphInterpreter.processPushRemoteInstruments.create/serialize/deserialize,ReusableOutboundEnvelope.init/copy/clear,ReusableInboundEnvelope.init/clear,artery.MessageDispatcher.dispatchEndpointManager.Send,EndpointWriter.writeSend,DefaultMessageDispatcher.dispatch,PekkoPduProtobufCodec.constructMessage/decodeMessageLinks pin the pekko-actor and pekko-http instrumentation at OpenTelemetry commit
6f9ca5672ce84edbbe36ce0e14386c31d68f479f(the same commit referenced from apache/pekko-http#1240). The remoting instrumentation is not merged upstream yet, so those comments link to open-telemetry/opentelemetry-java-instrumentation#19823 instead.Result
The load-bearing internal APIs are recorded next to the code, so a refactor of one of them is visible to the person making it and can be called out in release notes. Three new
InstrumentationPointsSpecsuites assert by reflection that each matched name, arity and parameter type is still present in the bytecode, so a change that would silently disable the agent fails the build instead.Tests
sbt "actor-tests/testOnly org.apache.pekko.dispatch.InstrumentationPointsSpec"- 6 passedsbt "stream-tests/testOnly org.apache.pekko.stream.impl.fusing.InstrumentationPointsSpec"- 1 passedsbt "remote/testOnly org.apache.pekko.remote.InstrumentationPointsSpec"- 10 passedsbt actor/mimaReportBinaryIssues stream/mimaReportBinaryIssues remote/mimaReportBinaryIssues- cleansbt scalafmtCheckAll scalafmtSbtCheck- passsbt headerCreateAll- headers added for the three new filesReferences
Fixes #3472
Refs apache/pekko-http#1240
Refs open-telemetry/opentelemetry-java-instrumentation#19823