Class: Fluent::Plugin::NodeExporterMetricsParser
- Inherits:
-
Parser
- Object
- Parser
- Fluent::Plugin::NodeExporterMetricsParser
- Defined in:
- lib/fluent/plugin/parser_node_exporter_metrics.rb
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #parse(data) ⇒ Object (also: #parse_partial_data)
- #parse_io(io, &block) ⇒ Object
- #parser_type ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
26 27 28 29 30 |
# File 'lib/fluent/plugin/parser_node_exporter_metrics.rb', line 26 def configure(conf) super @unpacker = Fluent::MessagePackFactory.engine_factory.unpacker @parser = Fluent::Plugin::NodeExporter::CMetricsDataSchemaParser.new end |
#parse(data) ⇒ Object Also known as: parse_partial_data
36 37 38 39 40 41 |
# File 'lib/fluent/plugin/parser_node_exporter_metrics.rb', line 36 def parse(data) @unpacker.feed_each(data) do |obj| metrics = @parser.parse(obj) yield Fluent::EventTime.now, metrics end end |
#parse_io(io, &block) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/fluent/plugin/parser_node_exporter_metrics.rb', line 45 def parse_io(io, &block) u = Fluent::MessagePackFactory.engine_factory.unpacker(io) u.each do |obj| metrics = @parser.parse(obj) yield Fluent::EventTime.now, metrics end end |
#parser_type ⇒ Object
32 33 34 |
# File 'lib/fluent/plugin/parser_node_exporter_metrics.rb', line 32 def parser_type :binary end |