From 733abef4db2fbeccd8fd29ea86312205e5a4274a Mon Sep 17 00:00:00 2001 From: Manoj Date: Mon, 19 Feb 2018 00:34:19 +0530 Subject: [PATCH] Cleanup metrics route --- .../scala/schemer/registry/routes/HealthRoutes.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/schemer-registry/src/main/scala/schemer/registry/routes/HealthRoutes.scala b/schemer-registry/src/main/scala/schemer/registry/routes/HealthRoutes.scala index 1fe6588..49d8e74 100644 --- a/schemer-registry/src/main/scala/schemer/registry/routes/HealthRoutes.scala +++ b/schemer-registry/src/main/scala/schemer/registry/routes/HealthRoutes.scala @@ -8,15 +8,15 @@ import akka.http.scaladsl.server.Directives._ import io.prometheus.client.Collector.MetricFamilySamples import io.prometheus.client.CollectorRegistry import io.prometheus.client.exporter.common.TextFormat -import io.prometheus.client.hotspot.{DefaultExports, StandardExports} +import io.prometheus.client.hotspot.DefaultExports trait HealthRoutes { DefaultExports.initialize() - val collectorRegistry = CollectorRegistry.defaultRegistry - private val mediaTypeParams = Map("version" -> "0.0.4") - private val mediaType = - MediaType.customWithFixedCharset("text", "plain", HttpCharsets.`UTF-8`, params = mediaTypeParams) + private val collectorRegistry = CollectorRegistry.defaultRegistry + private val metricsMediaTypeParams = Map("version" -> "0.0.4") + private val metricsMediaType = + MediaType.customWithFixedCharset("text", "plain", HttpCharsets.`UTF-8`, params = metricsMediaTypeParams) def toPrometheusTextFormat(e: util.Enumeration[MetricFamilySamples]): String = { val writer: Writer = new StringWriter() @@ -34,7 +34,7 @@ trait HealthRoutes { } ~ path("metrics") { get { complete { - HttpEntity(mediaType, toPrometheusTextFormat(collectorRegistry.metricFamilySamples())) + HttpEntity(metricsMediaType, toPrometheusTextFormat(collectorRegistry.metricFamilySamples())) } } }