Monitoring.kt 572 B

123456789101112131415161718192021222324
  1. package ru.mephi.plugins
  2. import io.ktor.features.*
  3. import org.slf4j.event.*
  4. import io.ktor.request.*
  5. import io.micrometer.prometheus.*
  6. import io.ktor.metrics.micrometer.*
  7. import io.ktor.application.*
  8. import io.ktor.response.*
  9. fun Application.configureMonitoring() {
  10. install(CallLogging) {
  11. level = Level.INFO
  12. filter { call -> call.request.path().startsWith("/") }
  13. }
  14. val appMicrometerRegistry = PrometheusMeterRegistry(PrometheusConfig.DEFAULT)
  15. install(MicrometerMetrics) {
  16. registry = appMicrometerRegistry
  17. // ...
  18. }
  19. }