Skip to content

Adds metric-api interface and default prometheus implementation#2

Open
fr3akX wants to merge 10 commits into
masterfrom
metrics-api-wip
Open

Adds metric-api interface and default prometheus implementation#2
fr3akX wants to merge 10 commits into
masterfrom
metrics-api-wip

Conversation

@fr3akX
Copy link
Copy Markdown

@fr3akX fr3akX commented Jun 18, 2018

No description provided.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+78.6%) to 78.571% when pulling d05f6de on metrics-api-wip into 7db750f on master.

2 similar comments
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+78.6%) to 78.571% when pulling d05f6de on metrics-api-wip into 7db750f on master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+78.6%) to 78.571% when pulling d05f6de on metrics-api-wip into 7db750f on master.

@coveralls
Copy link
Copy Markdown

coveralls commented Jun 18, 2018

Coverage Status

Coverage remained the same at 0.0% when pulling 643a819 on metrics-api-wip into 7db750f on master.

@fr3akX fr3akX requested a review from t3hnar June 18, 2018 11:13
Copy link
Copy Markdown
Contributor

@t3hnar t3hnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go through review once more when production issues being fixed.

Comment thread build.sbt Outdated
organizationHomepage := Some(url("http://evolutiongaming.com")),
bintrayOrganization := Some("evolutiongaming"),
scalaVersion := "2.12.4",
crossScalaVersions := Seq("2.12.4", "2.11.12"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.12.6 ?

Comment thread build.sbt Outdated
"io.prometheus" % "simpleclient_common",
"io.prometheus" % "simpleclient_hotspot",
"io.prometheus" % "simpleclient_logback"
).map(_ % "0.3.0")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.4.0

Comment thread build.sbt Outdated
.settings(Seq(
name := "prometheus-akka-http-exporter",
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.1.1" % Provided,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we combine constructor and method labels?

@fr3akX
Copy link
Copy Markdown
Author

fr3akX commented Jul 4, 2018

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 ?

@t3hnar
Copy link
Copy Markdown
Contributor

t3hnar commented Jul 5, 2018

@fr3akX usually I'm against adding such dependencies to libraries. This use case you are talking about keeps hitting many developers :)
So let's do and add shapeless

* 4. Label list generation: Generic repr -> ListGen & LabelEncoder -> List[String],
* default LabelEncoder is provided only for String
*/
trait Metric {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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", ())
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants