org.zalando.axiom.web.krueger.VertxMetricsService.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-krueger Show documentation
Show all versions of vertx-krueger Show documentation
This library creates vertx web endpoints exposing application metrics that can be consumed by Krueger (https://github.com/zalando/krueger-cockpit)
package org.zalando.axiom.web.krueger
import com.codahale.metrics.Counter
import com.codahale.metrics.MetricRegistry
import io.vertx.core.AsyncResultHandler
import io.vertx.core.Vertx
import io.vertx.core.json.JsonObject
import io.vertx.ext.dropwizard.MetricsService
import java.util.*
class VertxMetricsService(val vertx: Vertx, val metrics: MetricRegistry = MetricRegistry()) {
val metricsService: MetricsService = MetricsService.create(vertx)
fun getVertxMetrics(handler: AsyncResultHandler>) = vertx.executeBlocking(handler) {
listOf(metricsService.getMetricsSnapshot(vertx))
}
fun getStatusCodesMetrics(handler: AsyncResultHandler