10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/fluent/plugin/statsite/parser.rb', line 10
def build_record(k,v)
type, key, statistic, range = k.split(".", 4)
case type
when 'timers' then 1
if statistic == 'histogram'
{type: type, key: key, value: v.to_i, statistic: statistic, range: range[4..-1]}
elsif statistic == 'count'
{type: type, key: key, value: v.to_i, statistic: statistic}
else
{type: type, key: key, value: v.to_f, statistic: statistic}
end
when 'kv', 'gauges', 'counts'
{type: type, key: key, value: v.to_f}
when 'sets'
{type: type, key: key, value: v.to_i}
end
end
|