diff --git a/build.sbt b/build.sbt index 4a97197..64b8412 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,10 @@ lazy val root = (project in file(".")). "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion, "com.typesafe.akka" %% "akka-stream" % akkaVersion, "ch.qos.logback" % "logback-classic" % "1.2.11", - + "io.kamon" %% "kamon-bundle" % "2.5.9", + "io.kamon" %% "kamon-opentelemetry" % "2.5.9", +// "io.kamon" %% "kamon-apm-reporter" % "2.5.9", + "io.kamon" %% "kamon-newrelic" % "2.5.9", "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test, "com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test, "org.scalatest" %% "scalatest" % "3.2.12" % Test diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index acd17df..1204093 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -4,3 +4,15 @@ my-app { ask-timeout = 5s } } + +kamon { + environment.service = "Akka HTTP App" + newrelic { + nr-insights-insert-key = ${?NR_INSIGHTS_INSERT_KEY} + } + otel { + endpoint = ${?OTEL_EXPORTER_OTLP_ENDPOINT} + headers = ${?OTEL_KEY_HEADER} + } +} + diff --git a/src/main/scala/com/example/QuickstartApp.scala b/src/main/scala/com/example/QuickstartApp.scala index 59d4343..e3e6a9c 100644 --- a/src/main/scala/com/example/QuickstartApp.scala +++ b/src/main/scala/com/example/QuickstartApp.scala @@ -4,6 +4,7 @@ import akka.actor.typed.ActorSystem import akka.actor.typed.scaladsl.Behaviors import akka.http.scaladsl.Http import akka.http.scaladsl.server.Route +import kamon.Kamon import scala.util.Failure import scala.util.Success @@ -27,6 +28,7 @@ object QuickstartApp { } //#start-http-server def main(args: Array[String]): Unit = { + Kamon.init() //#server-bootstrapping val rootBehavior = Behaviors.setup[Nothing] { context => val userRegistryActor = context.spawn(UserRegistry(), "UserRegistryActor")