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  | 
    
      # 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) @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
      36 37 38  | 
    
      # File 'lib/logstash/output_delegator.rb', line 36 def concurrency @output_class.concurrency end  | 
  
#config_name ⇒ Object
      28 29 30  | 
    
      # File 'lib/logstash/output_delegator.rb', line 28 def config_name @output_class.config_name end  | 
  
#do_close ⇒ Object
      52 53 54  | 
    
      # File 'lib/logstash/output_delegator.rb', line 52 def do_close @strategy.do_close end  | 
  
#multi_receive(events) ⇒ Object
      44 45 46 47 48 49 50  | 
    
      # File 'lib/logstash/output_delegator.rb', line 44 def multi_receive(events) @metric_events.increment(:in, events.length) clock = @metric_events.time(:duration_in_millis) @strategy.multi_receive(events) clock.stop @metric_events.increment(:out, events.length) end  | 
  
#register ⇒ Object
      40 41 42  | 
    
      # File 'lib/logstash/output_delegator.rb', line 40 def register @strategy.register end  | 
  
#reloadable? ⇒ Boolean
      32 33 34  | 
    
      # File 'lib/logstash/output_delegator.rb', line 32 def reloadable? @output_class.reloadable? end  |