configure kamon

rm0193-mapreduce
Thibault Duplessis 2019-12-05 21:01:24 -06:00
parent 2a04707b07
commit 8fe32191e5
3 changed files with 24 additions and 56 deletions

View File

@ -6,11 +6,11 @@ import play.api.mvc._
import play.api.routing.Router
import router.Routes
class LilaAppLoader extends ApplicationLoader {
final class LilaAppLoader extends ApplicationLoader {
def load(ctx: Context): Application = new LilaComponents(ctx).application
}
class LilaComponents(ctx: Context) extends BuiltInComponentsFromContext(ctx)
final class LilaComponents(ctx: Context) extends BuiltInComponentsFromContext(ctx)
with _root_.controllers.AssetsComponents
with play.api.libs.ws.ahc.AhcWSComponents {
@ -93,8 +93,14 @@ class LilaComponents(ctx: Context) extends BuiltInComponentsFromContext(ctx)
lazy val userTournament: UserTournament = wire[UserTournament]
lazy val video: Video = wire[Video]
lazy val router: Router = {
// eagerly wire up all controllers
val router: Router = {
val prefix: String = "/"
wire[Routes]
}
if (configuration.get[String]("kamon.influxdb.hostname").nonEmpty) {
lila.log("boot").info("Kamon is enabled")
kamon.Kamon.loadModules()
}
}

View File

@ -509,57 +509,25 @@ akka {
}
kamon {
metric {
tick-interval = 20 second
track-unmatched-entities = yes
filters {
trace {
includes = [ "**" ]
excludes = [ ]
}
}
}
environment.service = "lila"
metric.tick-interval = 20 seconds # consider 60s
influxdb {
hostname = "127.0.0.1"
hostname = "" # lila starts kamon when this is set
port = 8086
# The maximum packet size for one POST request, set to 0 to disable batching
max-packet-size = 16384
# The protocol, either http or udp
protocol = "udp"
# The measurements will be named ${application-name}-timers and -counters
application-name = "dev"
# Allow users to override the name of the hostname reported by kamon. When changed, the hostname tag will be
# the value given here.
hostname-override = none
# For histograms, which percentiles to count
percentiles = [25.0, 50.0, 75.0, 95.0, 99.0]
# Subscription patterns used to select which metrics will be pushed to InfluxDB. Note that first, metrics
# collection for your desired entities must be activated under the kamon.metrics.filters settings.
subscriptions {
histogram = [ "**" ]
min-max-counter = [ "**" ]
gauge = [ "**" ]
counter = [ "**" ]
trace = [ "**" ]
trace-segment = [ "**" ]
akka-actor = [ "**" ]
akka-dispatcher = [ "**" ]
akka-router = [ "**" ]
system-metric = [ "**" ]
http-server = [ "**" ]
database = "kamon"
percentiles = [50.0, 75.0, 90.0, 95.0, 99.0, 99.9]
protocol = "http"
post-empty-distributions = true
precision = "s"
environment-tags {
include-service = yes
include-host = no
include-instance = no
}
}
modules {
kamon-influxdb {
auto-start = no
}
jvm-metrics.enabled = yes
process-metrics.enabled = yes
host-metrics.enabled = no
}
}

View File

@ -702,12 +702,6 @@ object mon {
}
}
final class Measurement(since: Long, path: RecPath) {
def finish() = path(lila.mon)(System.nanoTime() - since)
}
def startMeasurement(path: RecPath) = new Measurement(System.nanoTime(), path)
private val stripVersionRegex = """[^\w\.\-]""".r
private def stripVersion(v: String) = stripVersionRegex.replaceAllIn(v, "")
private def nodots(s: String) = s.replace('.', '_')