prometheus-exporter library which provides exporting metrics from application as Prometheus metrics via akka-http library. It can be injected as a akka.http.scaladsl.server.Route or can be started as a separate akka-http server.

Getting Started

 resolvers += Resolver.bintrayRepo("evolutiongaming", "maven") 
 libraryDependencies += "com.evolutiongaming" %% "prometheus-exporter" % "0.1.0" 

Configuration for http server can be done via

Metrics, Gauges, Counters etc

import com.evolutiongaming.metrics.MetricCollectors
import io.prometheus.client._

lazy val collectors: MetricCollectors = new MetricCollectors()

val incomingEventsCounter: Counter =
    collectors.registerCounter("events_in").help("Kafka input topic messages read"))
val fullTimer: Histogram =
    collectors.registerHistogram("c2k_fullsystem_delay").help("From core to output in ms").labelNames("c2k_time"))    

Embedding as a route

import com.evolutiongaming.metrics.{MetricResources, Report}

lazy val collectors: MetricCollectors = ...
def metrics = Report(collectors)
val metricsRoute = new MetricResources(metrics).route

val route = metricsRoute ~ otherRoute 

Starting as separateServer

import com.evolutiongaming.HttpServer

new HttpServer(Seq(metricsRoute, fooRoute, barRoute), "", "8080")