kamon-io/kamon-play

Problem instrumenting Play 2.7

cspinetta opened this issue · 5 comments

I tried to use Kamon 2.x with a Play 2.7 app and I couldn't make it work.

Attempts:

Case 1

plugins.sbt:

resolvers += Resolver.bintrayIvyRepo("kamon-io", "sbt-plugins")
"com.typesafe.play" % "sbt-plugin"                 % "2.7.0"
"io.kamon"          % "sbt-kanela-runner-play-2.7" % "2.0.0-RC1"

build.sbt:

lazy val root = (project in file("."))
  .enablePlugins(PlayScala, JavaAgent)
  .settings(
    libraryDependencies ++= Seq(
      "io.kamon" %% "kamon-bundle" % "2.0.0-RC2",
    )
  )
  .settings(fork in run := true)

Problem:

Response body is broken. eg:

��H���W(�/�I���J

Case 2

With no sbt-kanela-runner plugin and attaching the bundle on startup:

class Modules extends AbstractModule {
  override def configure(): Unit = {
    Bundle.attach()
  }
}

plugins.sbt:

"com.typesafe.play" % "sbt-plugin" % "2.7.0"

build.sbt:

lazy val root = (project in file("."))
  .enablePlugins(PlayScala, JavaAgent)
  .settings(
    libraryDependencies ++= Seq(
      "io.kamon" %% "kamon-bundle" % "2.0.0-RC2",
    )
  )
  .settings(fork in run := true)

Problem:

Response body is ok, because Kamon doesn't instrument anything.

Hey @cspinetta, I just tried to run this example and got the output bellow (first couple requests without the bundle, last ones just with the bundle).. it seems to be working as expected. Could you please maybe share a bit more about how were you testing the requests? I noticed there is a Gzip filter, could it be that what you are getting back is gzipped but the client is not unpacking it?

image

Hey @cspinetta, I was talking about with @dpsoft about this and I think it has to do with the bundle that you are using not having the latest Akka HTTP instrumentation which contains this commit: kamon-io/kamon-akka-http@632d97d

I'll try to release it as soon as possible for you to try again :)

Hey @ivantopo,
Trying to reproduce the problem in the minimum example app I found that the response is missing the headers, and depending on what client you use the body response will get decoded well or not because the header Content-Length is missed. Eg in Postman the body seems be broken but not by console. Therefore the problem is the headers are dropped and probably the commit you've mentioned solves it.
Thanks for your help! I await the release.

@ivantopo I tried again with "io.kamon" %% "kamon-bundle" % "2.0.0-RC3" and it worked properly!
Now I can't get the way to propagate headers using the config kamon.propagation.http.default.tags.mappings but that's another story. I'll try to work it out and if I can't I'll come again with the doubt.
Thank you very much!