Class: FFWD::PluginChannel
- Inherits:
-
Object
- Object
- FFWD::PluginChannel
- Defined in:
- lib/ffwd/plugin_channel.rb
Overview
A set of channels, one for metrics and one for events. This is simply a convenience class to group the channel that are available to a plugin in one direction (usually either input or output).
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#reporter_meta ⇒ Object
readonly
Returns the value of attribute reporter_meta.
Class Method Summary collapse
Instance Method Summary collapse
- #event(event) ⇒ Object
- #event_subscribe(&block) ⇒ Object
-
#initialize(id, events, metrics) ⇒ PluginChannel
constructor
A new instance of PluginChannel.
- #metric(metric) ⇒ Object
- #metric_subscribe(&block) ⇒ Object
Methods included from Logging
Methods included from Reporter
build_meta, included, #increment, map_meta, #report!, #reporter_data
Methods included from Lifecycle
#depend_on, #start, #started?, #starting, #starting_hooks, #stop, #stopped?, #stopping, #stopping_hooks
Constructor Details
#initialize(id, events, metrics) ⇒ PluginChannel
Returns a new instance of PluginChannel.
41 42 43 44 45 46 |
# File 'lib/ffwd/plugin_channel.rb', line 41 def initialize id, events, metrics @id = id @events = events @metrics = metrics @reporter_meta = {:channel => @id} end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
33 34 35 |
# File 'lib/ffwd/plugin_channel.rb', line 33 def events @events end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
33 34 35 |
# File 'lib/ffwd/plugin_channel.rb', line 33 def id @id end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
33 34 35 |
# File 'lib/ffwd/plugin_channel.rb', line 33 def metrics @metrics end |
#reporter_meta ⇒ Object (readonly)
Returns the value of attribute reporter_meta.
33 34 35 |
# File 'lib/ffwd/plugin_channel.rb', line 33 def @reporter_meta end |
Class Method Details
Instance Method Details
#event(event) ⇒ Object
52 53 54 55 |
# File 'lib/ffwd/plugin_channel.rb', line 52 def event event @events << event increment :events end |
#event_subscribe(&block) ⇒ Object
48 49 50 |
# File 'lib/ffwd/plugin_channel.rb', line 48 def event_subscribe &block @events.subscribe(&block) end |
#metric(metric) ⇒ Object
61 62 63 64 |
# File 'lib/ffwd/plugin_channel.rb', line 61 def metric metric @metrics << metric increment :metrics end |
#metric_subscribe(&block) ⇒ Object
57 58 59 |
# File 'lib/ffwd/plugin_channel.rb', line 57 def metric_subscribe &block @metrics.subscribe(&block) end |