Class: RailsRiemannMiddleware::Event
- Inherits:
-
Object
- Object
- RailsRiemannMiddleware::Event
- Defined in:
- lib/rails_riemann_middleware/event.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#reporting_host ⇒ Object
readonly
Returns the value of attribute reporting_host.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #<<(msg) ⇒ Object
- #app_prefix ⇒ Object
-
#initialize(options = {}) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(options = {}) ⇒ Event
Returns a new instance of Event.
8 9 10 11 12 13 14 |
# File 'lib/rails_riemann_middleware/event.rb', line 8 def initialize(={}) @options = @client = create_riemann_client @reporting_host = [:reporting_host] @tags = .fetch(:tags, []) @attributes = .fetch(:attributes, {}) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/rails_riemann_middleware/event.rb', line 6 def client @client end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/rails_riemann_middleware/event.rb', line 6 def @options end |
#reporting_host ⇒ Object (readonly)
Returns the value of attribute reporting_host.
6 7 8 |
# File 'lib/rails_riemann_middleware/event.rb', line 6 def reporting_host @reporting_host end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
6 7 8 |
# File 'lib/rails_riemann_middleware/event.rb', line 6 def @tags end |
Instance Method Details
#<<(msg) ⇒ Object
16 17 18 19 |
# File 'lib/rails_riemann_middleware/event.rb', line 16 def <<(msg) msg[:tags] += Array() client << {:time => time_for_client, :host => reporting_host}.merge(@attributes).merge(msg) end |
#app_prefix ⇒ Object
21 22 23 |
# File 'lib/rails_riemann_middleware/event.rb', line 21 def app_prefix .fetch(:app_prefix, "") end |