Search code examples
loggingtracemetricslagomkamon

Using Kamon with Lagom


I want to use use kamon with lagom.

I added the kamon bundle in my application and kanela-plugin, as per the documentation kanela should automatically start and instrumentation should begin but nothing happens.

Moreover I want to use log-reporter but I am not able to find "factory" to provide in the config file to use kamon-log-reporter module.

I added this plugin :-

addSbtPlugin("io.kamon" % "sbt-kanela-runner" % "2.0.3")

This is my build.sbt file:-

val kamon = "io.kamon" %% "kamon-bundle" % "2.0.4"
val logReporter = "io.kamon" %% "kamon-log-reporter" % "0.6.8"

lazy val `root` = (project in file("."))
  .enablePlugins(JavaAgent)
  .aggregate(`root-api`, `root-impl`)
  .settings(libraryDependencies in ThisBuild ++= Seq(macwire,kamon,logReporter))
  .settings(
    credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
  )
  .settings(
    javaOptions in Universal += "-DKamon.auto-start=true",
  )

This is my log-reporter conf:-

kamon{
  modules{
      enabled = true
      name ="LOG REPORTER"
      description = "Logs the metrics"
      factory = "" //don't know what to add here
      }
     }

Solution

  • kamon-log-reporter is old, and hasn't been updated to keep up with the latest changes in Kamon (1.0 and 2.0). You won't have any luck getting it working with sbt-kanela-runner (which is brand new).

    Instead, try kamon-logback - which provides instructions for how to get a trace ID logged. To look up other information about a particular trace, you'll have to run something like zipkin or jaeger alongside (or use a cloud service, like Kamon APM); I don't know if there are any reporters that output text any more.