From 3f3de2d2c5ffc17445dd59647f21d57f3816a0e5 Mon Sep 17 00:00:00 2001 From: Rafa Paradela Date: Mon, 22 Jan 2024 00:23:11 -0500 Subject: [PATCH 1/2] add kamon + otel collector --- build.sbt | 4 +++- src/main/resources/application.conf | 5 +++++ src/main/scala/com/example/QuickstartApp.scala | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4a97197..281c6e3 100644 --- a/build.sbt +++ b/build.sbt @@ -22,7 +22,9 @@ 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", "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..56d7a81 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -4,3 +4,8 @@ my-app { ask-timeout = 5s } } + +kamon { + environment.service = "Akka HTTP App" + apm.api-key = ${?KAMON_API_KEY} +} 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") From b834d364217f00aa2c81a002dca0c7a63bd1b8f9 Mon Sep 17 00:00:00 2001 From: Rafa Paradela Date: Thu, 25 Jan 2024 13:09:06 -0500 Subject: [PATCH 2/2] added new relic APM --- build.sbt | 3 ++- src/main/resources/application.conf | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 281c6e3..64b8412 100644 --- a/build.sbt +++ b/build.sbt @@ -24,7 +24,8 @@ lazy val root = (project in file(".")). "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-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 56d7a81..1204093 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -7,5 +7,12 @@ my-app { kamon { environment.service = "Akka HTTP App" - apm.api-key = ${?KAMON_API_KEY} + newrelic { + nr-insights-insert-key = ${?NR_INSIGHTS_INSERT_KEY} + } + otel { + endpoint = ${?OTEL_EXPORTER_OTLP_ENDPOINT} + headers = ${?OTEL_KEY_HEADER} + } } +