Sha256: 974efe2147e840c75e0ba60f49c507eec91b75ac884f29ba7d146d536c77535a
Contents?: true
Size: 992 Bytes
Versions: 4
Compression:
Stored size: 992 Bytes
Contents
module Datadog class Notifications class Config attr_accessor :hostname, :namespace, :tags, :statsd_host, :statsd_port, :reporter, :plugins def initialize @hostname = ENV['INSTRUMENTATION_HOSTNAME'] || Socket.gethostname @statsd_host = ENV['STATSD_HOST'] || ::Datadog::Statsd::DEFAULT_HOST @statsd_port = (ENV['STATSD_PORT'] || ::Datadog::Statsd::DEFAULT_PORT).to_i @reporter = Datadog::Notifications::Reporter @tags = [] @plugins = [] end # Use a plugin def use(klass, opts = {}) @plugins.push klass.new(opts) end def connect! env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] tags.push("env:#{env}") if env && tags.none? {|t| t =~ /^env\:/ } tags.push("host:#{hostname}") if tags.none? {|t| t =~ /^host\:/ } reporter.new statsd_host, statsd_port, namespace: namespace, tags: tags end protected :connect! end end end
Version data entries
4 entries across 4 versions & 1 rubygems