blob: 5696270cd497ad611ec73837e51e6f067c75e51c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package kamon.system.sigar
import kamon.metric.GenericEntityRecorder
import kamon.metric.instrument.InstrumentFactory
import org.hyperic.sigar.Sigar
class LoadAverageMetrics(sigar: Sigar, instrumentFactory: InstrumentFactory) extends GenericEntityRecorder(instrumentFactory) with SigarMetric {
val oneMinute = histogram("one-minute")
val fiveMinutes = histogram("five-minutes")
val fifteenMinutes = histogram("fifteen-minutes")
def update(): Unit = {
val loadAverage = sigar.getLoadAverage
oneMinute.record(loadAverage(0).toLong)
fiveMinutes.record(loadAverage(1).toLong)
fifteenMinutes.record(loadAverage(2).toLong)
}
}
object LoadAverageMetrics extends SigarMetricRecorderCompanion("load-average") {
def apply(sigar: Sigar, instrumentFactory: InstrumentFactory): LoadAverageMetrics =
new LoadAverageMetrics(sigar, instrumentFactory)
}
|