Repository navigation
Fix pekko-connectors-kafka producer instrumentation on Scala 3 - #6
Merged
Merged
Conversation
Scala 3 drops parameter annotations on the static forwarders of a plain object, so ByteBuddy treated the exit advice's Storage.Scope parameter as @argument(0) and failed to transform DefaultProducerStageLogic. Use a class with @static methods, as the other Scala 3 instrumentations do. Also instrument CommittingProducerSinkStageLogic, which was targeted but missing from 'within' and whose private produce method is name-mangled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs the producer stages against Kafka's MockProducer, so no broker is needed, and checks the Context captured on message creation is current when the stage calls send. Fails without the fix: all three tests on Scala 3, and the committable sink test on Scala 2.13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Brings over kamon-io#1432 (fixes kamon-io#1416). Both commits cherry-picked cleanly onto `main`.
ProduceWithEnvelopeContextis now a class + companion object with@staticmethods, advised viaclassOf. On Scala 3, the static forwarders of a plainobjectdrop parameter annotations, so ByteBuddy bound@Advice.Enterto the wrong argument.CommittingProducerSinkStageLogicis added towithininreference.conf, and the method matcher also accepts its private...$$producename.ProducerMessageInstrumentationSpec, which uses Kafka'sMockProducerand needs no broker.Checked locally (Java 17):
"+scalafmtCheckAll;scalafmtSbtCheck"passes and"+kamon-pekko-connectors-kafka/test"passes 3/3 on Scala 2.13.13 and 3.3.5.🤖 Generated with Claude Code