Class: OpenCensus::Trace::Exporters::Multi
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- OpenCensus::Trace::Exporters::Multi
- Defined in:
- lib/opencensus/trace/exporters/multi.rb
Overview
The Multi exporter multiplexes captured spans to a set of delegate exporters. It is useful if you need to export to more than one destination. You may also use it as a "null" exporter by providing no delegates.
Multi delegates to an array of the exporter objects. You can manage the list of exporters using any method of Array. For example:
multi = OpenCensus::Trace::Exporters::Multi.new
multi.export(spans) # Does nothing
multi << OpenCensus::Trace::Exporters::Logger.new
multi.export(spans) # Exports to the logger
Instance Method Summary collapse
-
#export(spans) ⇒ Object
Pass the captured spans to the delegates.
-
#initialize(*delegates) ⇒ Multi
constructor
Create a new Multi exporter.
Constructor Details
#initialize(*delegates) ⇒ Multi
Create a new Multi exporter
41 42 43 |
# File 'lib/opencensus/trace/exporters/multi.rb', line 41 def initialize *delegates super(delegates.flatten) end |
Instance Method Details
#export(spans) ⇒ Object
Pass the captured spans to the delegates.
50 51 52 53 |
# File 'lib/opencensus/trace/exporters/multi.rb', line 50 def export spans each { |delegate| delegate.export spans } nil end |