115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
# File 'lib/fluent/plugin/out_groupcounter.rb', line 115
def generate_fields(counts_per_tag, output = {}, key_prefix = '')
return {} unless counts_per_tag
counts_per_tag.each do |group_key, count|
group_key_with = group_key.empty? ? "" : group_key + @delimiter
output[key_prefix + group_key + @count_suffix] = count[:count] if count[:count]
output[key_prefix + group_key_with + "#{@min_key}#{@min_suffix}"] = count[:min] if count[:min]
output[key_prefix + group_key_with + "#{@max_key}#{@max_suffix}"] = count[:max] if count[:max]
output[key_prefix + group_key_with + "#{@avg_key}#{@avg_suffix}"] = count[:sum] / (count[:count] * 1.0) if count[:sum] and count[:count] > 0
end
output
end
|