module Fluent::StatsitePlugin::Parser
Public Instance Methods
build_record(k,v)
click to toggle source
# 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
parse_line(line)
click to toggle source
# File lib/fluent/plugin/statsite/parser.rb, line 4 def parse_line(line) k,v,t = line.chomp.split('|') record = build_record(k,v) [t.to_i, record] end