Class: LogStash::OutputDelegator
- Inherits:
-
Object
- Object
- LogStash::OutputDelegator
- Defined in:
- lib/logstash/output_delegator.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metric ⇒ Object
readonly
Returns the value of attribute metric.
-
#metric_events ⇒ Object
readonly
Returns the value of attribute metric_events.
-
#namespaced_metric ⇒ Object
readonly
Returns the value of attribute namespaced_metric.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
- #concurrency ⇒ Object
- #config_name ⇒ Object
- #do_close ⇒ Object
-
#initialize(logger, output_class, metric, execution_context, strategy_registry, plugin_args) ⇒ OutputDelegator
constructor
A new instance of OutputDelegator.
- #multi_receive(events) ⇒ Object
- #register ⇒ Object
- #reloadable? ⇒ Boolean
Constructor Details
#initialize(logger, output_class, metric, execution_context, strategy_registry, plugin_args) ⇒ OutputDelegator
Returns a new instance of OutputDelegator.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/logstash/output_delegator.rb', line 10 def initialize(logger, output_class, metric, execution_context, strategy_registry, plugin_args) @logger = logger @output_class = output_class @metric = metric @id = plugin_args["id"] raise ArgumentError, "No strategy registry specified" unless strategy_registry raise ArgumentError, "No ID specified! Got args #{plugin_args}" unless id @namespaced_metric = metric.namespace(id.to_sym) @namespaced_metric.gauge(:name, config_name) @metric_events = @namespaced_metric.namespace(:events) @in_counter = @metric_events.counter(:in) @out_counter = @metric_events.counter(:out) @time_metric = @metric_events.counter(:duration_in_millis) @strategy = strategy_registry. class_for(self.concurrency). new(@logger, @output_class, @namespaced_metric, execution_context, plugin_args) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/logstash/output_delegator.rb', line 8 def id @id end |
#metric ⇒ Object (readonly)
Returns the value of attribute metric.
8 9 10 |
# File 'lib/logstash/output_delegator.rb', line 8 def metric @metric end |
#metric_events ⇒ Object (readonly)
Returns the value of attribute metric_events.
8 9 10 |
# File 'lib/logstash/output_delegator.rb', line 8 def metric_events @metric_events end |
#namespaced_metric ⇒ Object (readonly)
Returns the value of attribute namespaced_metric.
8 9 10 |
# File 'lib/logstash/output_delegator.rb', line 8 def namespaced_metric @namespaced_metric end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
8 9 10 |
# File 'lib/logstash/output_delegator.rb', line 8 def strategy @strategy end |
Instance Method Details
#concurrency ⇒ Object
38 39 40 |
# File 'lib/logstash/output_delegator.rb', line 38 def concurrency @output_class.concurrency end |
#config_name ⇒ Object
30 31 32 |
# File 'lib/logstash/output_delegator.rb', line 30 def config_name @output_class.config_name end |
#do_close ⇒ Object
54 55 56 |
# File 'lib/logstash/output_delegator.rb', line 54 def do_close @strategy.do_close end |
#multi_receive(events) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/logstash/output_delegator.rb', line 46 def multi_receive(events) @in_counter.increment(events.length) start_time = java.lang.System.current_time_millis @strategy.multi_receive(events) @time_metric.increment(java.lang.System.current_time_millis - start_time) @out_counter.increment(events.length) end |
#register ⇒ Object
42 43 44 |
# File 'lib/logstash/output_delegator.rb', line 42 def register @strategy.register end |
#reloadable? ⇒ Boolean
34 35 36 |
# File 'lib/logstash/output_delegator.rb', line 34 def reloadable? @output_class.reloadable? end |