Class: Rnotifier::EventData
- Inherits:
-
Object
- Object
- Rnotifier::EventData
- Defined in:
- lib/rnotifier/event_data.rb
Constant Summary collapse
- EVENT =
0- ALERT =
1
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, type, data = {}, tags = nil) ⇒ EventData
constructor
A new instance of EventData.
- #notify ⇒ Object
Constructor Details
#initialize(name, type, data = {}, tags = nil) ⇒ EventData
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rnotifier/event_data.rb', line 8 def initialize(name, type, data = {}, = nil) @data = { :name => name, :data => data, :app_env => EventData.app_env, :occurred_at => Time.now.to_i, :rnotifier_client => Config::CLIENT, :type => type, } @data[:context_data] = Thread.current[:rnotifier_context] if Thread.current[:rnotifier_context] @data[:tags] = if end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/rnotifier/event_data.rb', line 3 def data @data end |
Class Method Details
.app_env ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/rnotifier/event_data.rb', line 30 def self.app_env @app_env ||= { :env => Config.current_env, :pid => $$, :host => (Socket.gethostname rescue ''), :language => 'ruby' } end |
Instance Method Details
#notify ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/rnotifier/event_data.rb', line 21 def notify begin Notifier.send(data, Rnotifier::Config.event_path) rescue Exception => e Rlogger.error("[EVENT NOTIFY] #{e.message}") Rlogger.error("[EVENT NOTIFY] #{e.backtrace}") end end |