Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kamon + otel collector #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
}

2 changes: 2 additions & 0 deletions src/main/scala/com/example/QuickstartApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down