Adds metric-api interface and default prometheus implementation#2
Adds metric-api interface and default prometheus implementation#2fr3akX wants to merge 10 commits into
Conversation
2 similar comments
t3hnar
left a comment
There was a problem hiding this comment.
I'll go through review once more when production issues being fixed.
| organizationHomepage := Some(url("http://evolutiongaming.com")), | ||
| bintrayOrganization := Some("evolutiongaming"), | ||
| scalaVersion := "2.12.4", | ||
| crossScalaVersions := Seq("2.12.4", "2.11.12"), |
| "io.prometheus" % "simpleclient_common", | ||
| "io.prometheus" % "simpleclient_hotspot", | ||
| "io.prometheus" % "simpleclient_logback" | ||
| ).map(_ % "0.3.0") |
| .settings(Seq( | ||
| name := "prometheus-akka-http-exporter", | ||
| libraryDependencies ++= Seq( | ||
| "com.typesafe.akka" %% "akka-http" % "10.1.1" % Provided, |
There was a problem hiding this comment.
Would be nice to have those all in Dependencies objects with out duplicating definitions and versions.
| def register(collector: Collector): Unit = registry.register(collector) | ||
|
|
||
| class PrometheusCounter(labels: Seq[String], counter: PCounter) extends Counter { | ||
| override def labels(labels: Seq[String]): Counter = new PrometheusCounter(labels, counter) |
There was a problem hiding this comment.
shouldn't we combine constructor and method labels?
|
Im thinking to introduce shapeless, to add more type safety on labels, because now You will get runtime exception if label names and labels mismatches. What do You think @t3hnar ? |
|
@fr3akX usually I'm against adding such dependencies to libraries. This use case you are talking about keeps hitting many developers :) |
| * 4. Label list generation: Generic repr -> ListGen & LabelEncoder -> List[String], | ||
| * default LabelEncoder is provided only for String | ||
| */ | ||
| trait Metric { |
There was a problem hiding this comment.
I'm not quite happy with such bulky interface, but not sure how to avoid this.
| } | ||
|
|
||
| it should "report recorded metrics" in { metrics => | ||
| val g = metrics.gauge("test", "provides test gauge", ()) |
There was a problem hiding this comment.
Not really like api without labels, as always should provide some type, which in this case is Unit which has LabelGen instance. Probably method overload would do, but that will add even more boiler plate to Metrics trait. Mby some of the boilerplate can be generated using macros.
No description provided.