Class: Datadog::Notifications::Config
- Inherits:
-
Object
- Object
- Datadog::Notifications::Config
- Defined in:
- lib/datadog/notifications/config.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
-
#reporter ⇒ Object
Returns the value of attribute reporter.
-
#socket_path ⇒ Object
Returns the value of attribute socket_path.
-
#statsd_host ⇒ Object
Returns the value of attribute statsd_host.
-
#statsd_port ⇒ Object
Returns the value of attribute statsd_port.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#use(klass, **opts) ⇒ Object
Use a plugin.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 |
# File 'lib/datadog/notifications/config.rb', line 6 def initialize @hostname = ENV.fetch('INSTRUMENTATION_HOSTNAME') { Socket.gethostname } @statsd_host = ENV.fetch('STATSD_HOST', nil) @statsd_port = ENV.fetch('STATSD_PORT', nil) @socket_path = ENV.fetch('SOCKET_PATH', nil) @reporter = Datadog::Notifications::Reporter @tags = [] @plugins = [] end |
Instance Attribute Details
#hostname ⇒ Object
Returns the value of attribute hostname.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def hostname @hostname end |
#namespace ⇒ Object
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def namespace @namespace end |
#plugins ⇒ Object
Returns the value of attribute plugins.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def plugins @plugins end |
#reporter ⇒ Object
Returns the value of attribute reporter.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def reporter @reporter end |
#socket_path ⇒ Object
Returns the value of attribute socket_path.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def socket_path @socket_path end |
#statsd_host ⇒ Object
Returns the value of attribute statsd_host.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def statsd_host @statsd_host end |
#statsd_port ⇒ Object
Returns the value of attribute statsd_port.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def statsd_port @statsd_port end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/datadog/notifications/config.rb', line 4 def @tags end |
Instance Method Details
#use(klass, **opts) ⇒ Object
Use a plugin
17 18 19 |
# File 'lib/datadog/notifications/config.rb', line 17 def use(klass, **opts) @plugins.push klass.new(**opts) end |