Skip to content

Add kamon-play3 module supporting Play 3 on Scala 2.13 and 3 - #1433

Open
pjfanning wants to merge 2 commits into
kamon-io:masterfrom
pjfanning:scala3-kamon-play
Open

pjfanning wants to merge 2 commits into
kamon-io:masterfrom
pjfanning:scala3-kamon-play

Conversation

@pjfanning

Copy link
Copy Markdown
Contributor

Fixes #1418

kamon-play is built against Play 2.8 and depends on kamon-akka and kamon-akka-http, neither of which is built for Scala 3, so kamon-play can't be cross-built for Scala 3.

This adds a kamon-play3 module that supports only Play 3 (Pekko) and is cross-built for Scala 2.13 and 3. kamon-play is unchanged.

  • Sources are kamon-play's with the Akka HTTP server hook removed. The package and the kamon.instrumentation.play.* config keys are unchanged, so Play 3 users only need to swap the dependency.
  • Advices use the class + @static pattern, since Scala 3 static forwarders drop parameter annotations (same issue as [kamon-pekko-connectors-kafka] Kamon 2.8.1 throws IllegalStateException when using pekko-connectors-kafka 1.1.0 #1416). The connection timestamp is now captured in the constructor advice, rather than with the object-based CaptureCurrentTimestampOnExit.
  • The HasServerInstrumentation.Mixin var constructor params became explicit methods. Scala 3 rejects a var overriding a () method.
  • Tests are kamon-play's test-common specs run against Play 3.0.7. Early initializers were replaced with constructor params, and response.body with response.body[String] (ambiguous implicit on Scala 3).

kamon-play3 is not added to the bundles. It shares class names with kamon-play, so the two shouldn't be on the same classpath.

Tested locally: kamon-play3/test passes on 2.13.13 and 3.3.5 (18 tests each).

🤖 Generated with Claude Code

pjfanning and others added 2 commits October 10, 2026 20:50
kamon-play is built against Play 2.8 and depends on the Akka modules, so it
can't be built for Scala 3. kamon-play3 supports only Play 3 (Pekko) and is
cross-built for Scala 2.13 and 3. Advices use the class plus @static pattern
because Scala 3 static forwarders drop parameter annotations.

Fixes kamon-io#1418

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

kamon-play v2.8.0 doesn't support scala 3.x

1 participant