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(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(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 |
# File 'lib/logstash/output_delegator.rb', line 10 def initialize(output_class, metric, execution_context, strategy_registry, plugin_args) @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(@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
37 38 39 |
# File 'lib/logstash/output_delegator.rb', line 37 def concurrency @output_class.concurrency end |
#config_name ⇒ Object
29 30 31 |
# File 'lib/logstash/output_delegator.rb', line 29 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
45 46 47 48 49 50 51 52 |
# File 'lib/logstash/output_delegator.rb', line 45 def multi_receive(events) count = events.size @in_counter.increment(count) start_time = java.lang.System.nano_time @strategy.multi_receive(events) @time_metric.increment((java.lang.System.nano_time - start_time) / 1_000_000) @out_counter.increment(count) end |
#register ⇒ Object
41 42 43 |
# File 'lib/logstash/output_delegator.rb', line 41 def register @strategy.register end |
#reloadable? ⇒ Boolean
33 34 35 |
# File 'lib/logstash/output_delegator.rb', line 33 def reloadable? @output_class.reloadable? end |