Add kamon.io metrics reporting (#395)

* Add kamon.io metrics reporting

* Line length + whitespace
This commit is contained in:
Mazo 2020-04-29 19:59:12 +01:00 committed by GitHub
parent 4e5bb3a252
commit eabb952683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 1 deletions

View file

@ -44,7 +44,9 @@ lazy val commonSettings = Seq(
"com.github.mauricio" %% "postgresql-async" % "0.2.21",
"com.github.t3hnar" %% "scala-bcrypt" % "3.1",
"org.ini4j" % "ini4j" % "0.5.4",
"org.scala-graph" %% "graph-core" % "1.12.5"
"org.scala-graph" %% "graph-core" % "1.12.5",
"io.kamon" %% "kamon-bundle" % "2.1.0",
"io.kamon" %% "kamon-apm-reporter" % "2.1.0"
)
)

View file

@ -218,3 +218,17 @@ NetSim.ReorderTime = 150 milliseconds
#
###################################################################################################
[kamon]
# Kamon
#
# Active (boolean)
# Description: Enables reporting of metrics to Kamon.io
# Important: Ensure the API key is set in application.conf in the same
# folder as PsLogin.scala
# Default: no - (Disabled)
# yes - (Enabled)
Active = no

View file

@ -2,5 +2,6 @@ logLevel := Level.Warn
addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.12")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("io.kamon" % "sbt-kanela-runner" % "2.0.6")
// https://github.com/sbt/sbt-unidoc
//addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.2")

View file

@ -28,6 +28,8 @@ import scala.collection.JavaConverters._
import scala.concurrent.Await
import scala.concurrent.duration._
import kamon.Kamon
object PsLogin {
private val logger = org.log4s.getLogger
@ -221,6 +223,15 @@ object PsLogin {
"akka.logging-filter" -> "akka.event.slf4j.Slf4jLoggingFilter"
).asJava
WorldConfig.Get[Boolean]("kamon.Active") match {
case true =>
logger.info("Starting Kamon")
Kamon.init()
case _ => ;
}
logger.info("Starting actor subsystems")
/** Start up the main actor system. This "system" is the home for all actors running on this server */

View file

@ -37,6 +37,9 @@ object WorldConfig extends ConfigParser {
ConfigEntryTime ("NetSim.Delay", 150 milliseconds, Constraints.min(0 seconds), Constraints.max(2 seconds)),
ConfigEntryFloat("NetSim.ReorderChance", 0.005f, Constraints.min(0.0f), Constraints.max(1.0f)),
ConfigEntryTime ("NetSim.ReorderTime", 150 milliseconds, Constraints.min(0 seconds), Constraints.max(2 seconds))
),
ConfigSection("kamon",
ConfigEntryBool("Active", false)
)
)

View file

@ -0,0 +1,4 @@
kamon {
environment.service = "PSForever"
apm.api-key = ""
}