20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/fluent/plugin/filter_redfishmetric.rb', line 20
def filter_stream(tag, es)
new_es = Fluent::MultiEventStream.new
es.each { |time, record|
@metricValueList = record["MetricValues"]
@metricValueList&.each do |val|
begin
myRecord = {}
myRecord["Namespace"] = @Namespace
myRecord["Report"] = record["Id"]
myRecord["Metric"] = val["MetricId"]
myRecord["Value"] = val["MetricValue"]
myRecord["Dimension"] = {"Region" => @Coloregion, "IP" => record["REMOTE_ADDR"]}
if @Filter
if @Metric&.include?(val["MetricId"])
new_es.add(time, myRecord)
end
else
new_es.add(time, myRecord)
end
rescue => e
router.emit_error_event(tag, time, record, e)
end
end
}
new_es
end
|