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
Returns a new instance of 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[: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
33 34 35 36 37 38 39 40 41 |
# File 'lib/rnotifier/event_data.rb', line 33 def self.app_env @app_env ||= { :env => Config.current_env, :pid => $$, :host => (Socket.gethostname rescue ''), :language => 'ruby', :timezone => (Time.now.zone rescue nil) } end |
Instance Method Details
#notify ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rnotifier/event_data.rb', line 21 def notify return false unless Config.valid? begin Notifier.send(data, Config.event_path) rescue Exception => e Rlogger.error("[EVENT NOTIFY] #{e.}") Rlogger.error("[EVENT NOTIFY] #{e.backtrace}") false end end |