Kamon
Kamon copied to clipboard
play/akka-http-server instrumentation not working if PlayAkkaHttp2Support enabled
If you have .enablePlugins(PlayAkkaHttp2Support)
in your build.sbt for your play application, the http1.1 server is not instrumented, but the http2 server is. If this plugin is removed, then instrumentation works for http1.1. I'm on scala 2.13, haven't tested other versions.
Notice how in HTTP1.1 there is no trace-id
, but in HTTP2 there is.
❯ curl --http1.1 -I localhost:9000/services
HTTP/1.1 200 OK
Date: Thu, 11 Feb 2021 20:50:55 GMT
Content-Type: application/json
Content-Length: 1627
❯ curl --http2 -I localhost:9000/services
HTTP/1.1 101 Switching Protocols
Upgrade: h2c
Date: Thu, 11 Feb 2021 20:50:57 GMT
Connection: upgrade
HTTP/2 200
content-type: application/json
content-length: 1627
trace-id: 6fa67757e3247799
date: Thu, 11 Feb 2021 20:47:18 GMT
The PlayAkkaHttp2Support plugin is minimal - https://git.io/JtK9l I've copied the code here:
object PlayAkkaHttp2Support extends AutoPlugin {
override def requires = PlayAkkaHttpServer && JavaAgent
override def projectSettings = Seq(
libraryDependencies += "com.typesafe.play" %% "play-akka-http2-support" % PlayVersion.current,
javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % PlayVersion.jettyAlpnAgentVersion % "compile;test"
)
}