blob: 3e02cc8fc274f63cfd1ef06fa594019301878112 (
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(instrumentFactory: InstrumentFactory) extends GenericEntityRecorder(instrumentFactory) with SigarMetric {
val oneMinute = histogram("one-minute")
val fiveMinutes = histogram("five-minutes")
val fifteenMinutes = histogram("fifteen-minutes")
def update(sigar: Sigar): 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(instrumentFactory: InstrumentFactory): LoadAverageMetrics =
new LoadAverageMetrics(instrumentFactory)
}
|