-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the endpoint /api/metrics for Prometheus. #175
Merged
alexeyeryshev
merged 14 commits into
criteo:master
from
alexeyeryshev:eryshev/prometheus_metrics
Oct 2, 2017
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
03d654f
Refacto cuttle.logging package. Add Metrics, MetricRepository, Promet…
c17870b
Small refactorings in Executor.scala.
a035454
Merge branch 'master' into eryshev/prometheus_metrics
guillaumebort 998215b
Delete MetricRepository in favor of MetricProvider.
0c718d8
Change metrics route to /metrics.
9d4df04
Merge remote-tracking branch 'upstream/master' into eryshev/prometheu…
97f3e2f
Add the metric with timestamp of last success of a job.
db26da8
Change the metric type to gauge.
754d1fb
Don't send the last success metric for jobs thats doesn't have any DO…
0601dac
Correction metric format to Prometheus compatible.
e5aa635
Scoping metrics into a Metrics object and some scoping improvements.
eb5bcc7
Add a JVM uptime metric.
e1f6c24
Query executor state in atomic way for stats and metrics.
760243c
Merge branch 'master' into eryshev/prometheus_metrics
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ain/scala/com/criteo/cuttle/Logging.scala → ...main/scala/com/criteo/cuttle/Logger.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.criteo.cuttle.logging | ||
package com.criteo.cuttle | ||
|
||
trait Logger { | ||
def debug(message: => String): Unit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.criteo.cuttle | ||
|
||
object Metrics { | ||
sealed trait Metric { | ||
def toString: String | ||
} | ||
|
||
case class Gauge(name: String, value: Long, tags: Seq[(String, String)] = Seq.empty) extends Metric | ||
|
||
trait MetricProvider { | ||
def getMetrics(jobs: Set[String]): Seq[Metric] | ||
} | ||
|
||
private[cuttle] object Prometheus { | ||
def format(metrics: Seq[Metric]): String = { | ||
val prometheusMetrics = metrics.map { | ||
case Gauge(name, value, tags) => | ||
s"$name${ | ||
if (tags.nonEmpty) s" {${tags.map(tag => s"""${tag._1}="${tag._2}"""").mkString(", ")}}" | ||
else "" | ||
} $value" | ||
} | ||
|
||
s"${prometheusMetrics.mkString("\n")}\n" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we scope all this into a
Metrics
object, so in the public API it's all coherent?