Class: Metrix::Load
Instance Attribute Summary
Attributes inherited from Base
#attributes, #time
Instance Method Summary
collapse
Methods inherited from Base
#cast_int, ignore, #ignore_metric?, ignore_metrics, inherited, known_metrics, #metrics, prefix, set_known_metrics, set_prefix, subclasses, #tagged_metrics, #tags, #unfiltered_metrics
Constructor Details
#initialize(data) ⇒ Load
Returns a new instance of Load.
8
9
10
11
|
# File 'lib/metrix/load.rb', line 8
def initialize(data)
@data = data
@time = Time.now
end
|
Instance Method Details
#chunks ⇒ Object
37
38
39
|
# File 'lib/metrix/load.rb', line 37
def chunks
@chunks ||= @data.split(" ")
end
|
13
14
15
16
17
18
19
|
# File 'lib/metrix/load.rb', line 13
def (data)
{
load1: load1,
load5: load5,
load15: load15,
}
end
|
#load1 ⇒ Object
33
34
35
|
# File 'lib/metrix/load.rb', line 33
def load1
chunks.at(0).to_f
end
|
#load15 ⇒ Object
25
26
27
|
# File 'lib/metrix/load.rb', line 25
def load15
chunks.at(2).to_f
end
|
#load5 ⇒ Object
29
30
31
|
# File 'lib/metrix/load.rb', line 29
def load5
chunks.at(1).to_f
end
|
#prefix ⇒ Object
21
22
23
|
# File 'lib/metrix/load.rb', line 21
def prefix
"system.load"
end
|