aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/resources/reference.conf20
-rw-r--r--src/main/scala/xyz/driver/core/app/DriverApp.scala7
2 files changed, 27 insertions, 0 deletions
diff --git a/src/main/resources/reference.conf b/src/main/resources/reference.conf
index fd2da69..ac4b253 100644
--- a/src/main/resources/reference.conf
+++ b/src/main/resources/reference.conf
@@ -69,3 +69,23 @@ swagger {
licenseUrl = "http://www.apache.org/licenses/LICENSE-2.0"
}
}
+
+# Kamon provides monitoring capabilities
+kamon {
+ system-metrics {
+ # sigar reports host-specific metrics. Kubernetes takes care of
+ # that for Driver services.
+ host.enabled = false
+
+ # JVM-related metrics
+ jmx.enabled = true
+ }
+
+ statsd {
+ hostname = localhost
+ port = 8125
+ simple-metric-key-generator {
+ include-hostname = false
+ }
+ }
+}
diff --git a/src/main/scala/xyz/driver/core/app/DriverApp.scala b/src/main/scala/xyz/driver/core/app/DriverApp.scala
index 6dd98e3..9cb53af 100644
--- a/src/main/scala/xyz/driver/core/app/DriverApp.scala
+++ b/src/main/scala/xyz/driver/core/app/DriverApp.scala
@@ -12,6 +12,9 @@ import akka.stream.ActorMaterializer
import com.typesafe.config.Config
import com.typesafe.scalalogging.Logger
import io.swagger.models.Scheme
+import kamon.Kamon
+import kamon.statsd.StatsDReporter
+import kamon.system.SystemMetrics
import org.slf4j.{LoggerFactory, MDC}
import xyz.driver.core
import xyz.driver.core.rest._
@@ -47,6 +50,10 @@ class DriverApp(
val appEnvironment: String = config.getString("application.environment")
def run(): Unit = {
+ Console.print("Starting metrics collection...\n")
+ Kamon.addReporter(new StatsDReporter())
+ SystemMetrics.startCollecting()
+ Console.print("Metrics collection started\n")
activateServices(modules)
scheduleServicesDeactivation(modules)
bindHttp(modules)