Skip to content

Commit

Permalink
added cumulative workers metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Evdokimov committed Sep 5, 2017
1 parent 02a6b3a commit 9814fa3
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@ object Instrumented {
def metrics(id: String, name: String, registry: MetricRegistry): Instrument = {
val queue = registry histogram s"$name.queue"
val run = registry histogram s"$name.run"
val workers = registry counter s"$name.workers"
val workersCurrent = registry counter s"$name.workers.current" // current value, very volatile
val workers = registry histogram s"$name.workers" // aggregated metrics

() => {
val created = Platform.currentTime
() => {
val started = Platform.currentTime
queue update started - created
workers.inc()
workersCurrent.inc()
workers.update(workersCurrent.getCount)
() => {
val stopped = Platform.currentTime
run update stopped - started
workers.dec()
workersCurrent.dec()
()
}
}
Expand Down

0 comments on commit 9814fa3

Please sign in to comment.