Class: Datadog::Notifications::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/notifications/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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

#hostnameObject

Returns the value of attribute hostname.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def hostname
  @hostname
end

#namespaceObject

Returns the value of attribute namespace.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def namespace
  @namespace
end

#pluginsObject

Returns the value of attribute plugins.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def plugins
  @plugins
end

#reporterObject

Returns the value of attribute reporter.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def reporter
  @reporter
end

#socket_pathObject

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_hostObject

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_portObject

Returns the value of attribute statsd_port.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def statsd_port
  @statsd_port
end

#tagsObject

Returns the value of attribute tags.


4
5
6
# File 'lib/datadog/notifications/config.rb', line 4

def tags
  @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