Class: Fluent::Plugin::ExMonitorAgentInput
- Inherits:
-
MonitorAgentInput
- Object
- MonitorAgentInput
- Fluent::Plugin::ExMonitorAgentInput
- Defined in:
- lib/fluent/plugin/tdms_ext_fluentd.rb
Constant Summary collapse
- TD_MONITOR_INFO =
MONITOR_INFO.merge( 'buffer_type' => '@buffer_config[:@type]', 'buffer_path' => '@buffer.path', 'flush_interval' => '@buffer_config.flush_interval')
- TD_PLUGIN_METRIC_INFO =
{ 'buffer_queue_length' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer); @buffer.queue.size }, 'buffer_queued_size' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer); @buffer.stage_size + @buffer.queue_size }, 'emit_count' => ->(){ @emit_count }, 'retry_count' => ->(){ throw(:skip) unless instance_variable_defined?(:@buffer) && !@buffer.nil? && @buffer.is_a?(::Fluent::Plugin::Buffer) begin @retry ? @retry.steps : 0 rescue 0 end }, }
Instance Method Summary collapse
Methods inherited from MonitorAgentInput
Instance Method Details
#get_monitor_info(pe, opts = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 41 def get_monitor_info(pe, opts = {}) obj = {'plugin_id'.freeze => pe.plugin_id} conf = { 'type'.freeze => pe.config['@type'.freeze] || pe.config['type'.freeze], 'output_plugin'.freeze => pe.is_a?(::Fluent::Plugin::Output), 'plugin_category'.freeze => plugin_category(pe) } if pe.is_a?(::Fluent::Plugin::Output) && pe.instance_variable_get(:@buffering) TD_MONITOR_INFO.each_pair { |key, code| begin v = pe.instance_eval(code) unless v.nil? conf[key] = v end rescue end } obj['metrics'] = get_plugin_metric(pe) end obj['config'] = conf obj end |
#get_plugin_metric(pe) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/fluent/plugin/tdms_ext_fluentd.rb', line 66 def get_plugin_metric(pe) metrics = {} TD_PLUGIN_METRIC_INFO.each_pair { |key, code| begin v = pe.instance_exec(&code) unless v.nil? metrics[key] = {'value' => v} end rescue end } # set each configruration limit total_size = pe.instance_eval('@buffer.total_limit_size') metrics['buffer_queue_length']['max'] = total_size / pe.instance_eval('@buffer.chunk_limit_size') metrics['buffer_queued_size']['max'] = total_size metrics end |