Class: ExceptionDog::AgentNotifier
- Inherits:
-
Object
- Object
- ExceptionDog::AgentNotifier
- Defined in:
- lib/exception_dog/agent_notifier.rb
Constant Summary collapse
- OPTS_WHITELIST =
[:priority, :tags, :aggregation_key, :source_type_name, :alert_type]
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(configuration) ⇒ AgentNotifier
constructor
A new instance of AgentNotifier.
- #notify(title, text, opts) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ AgentNotifier
14 15 16 17 |
# File 'lib/exception_dog/agent_notifier.rb', line 14 def initialize(configuration) @configuration = configuration @logger = configuration.logger end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
9 10 11 |
# File 'lib/exception_dog/agent_notifier.rb', line 9 def configuration @configuration end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/exception_dog/agent_notifier.rb', line 10 def logger @logger end |
Instance Method Details
#errors ⇒ Object
25 26 27 28 29 |
# File 'lib/exception_dog/agent_notifier.rb', line 25 def errors @errors = [] @errors << "Invalid host setup" unless configuration.agent_port && configuration.agent_host @errors end |
#notify(title, text, opts) ⇒ Object
19 20 21 22 23 |
# File 'lib/exception_dog/agent_notifier.rb', line 19 def notify(title, text, opts) logger.info "ExceptionDog::send_to_agent" @@socket ||= Datadog::Statsd.new(configuration.agent_host, configuration.agent_port, logger: configuration.logger) response = @@socket.event(title, text, opts) end |