Module: Racecar::Datadog

Defined in:
lib/racecar/datadog.rb

Defined Under Namespace

Classes: ConsumerSubscriber, ProducerSubscriber, StatsdSubscriber

Constant Summary collapse

STATSD_NAMESPACE =
"racecar"

Class Method Summary collapse

Class Method Details

.closeObject



79
80
81
# File 'lib/racecar/datadog.rb', line 79

def close
  @statsd&.close
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



17
18
19
# File 'lib/racecar/datadog.rb', line 17

def configure
  yield self
end

.hostObject



34
35
36
# File 'lib/racecar/datadog.rb', line 34

def host
  @host
end

.host=(host) ⇒ Object



38
39
40
41
# File 'lib/racecar/datadog.rb', line 38

def host=(host)
  @host = host
  clear
end

.namespaceObject



61
62
63
# File 'lib/racecar/datadog.rb', line 61

def namespace
  @namespace ||= STATSD_NAMESPACE
end

.namespace=(namespace) ⇒ Object



65
66
67
68
# File 'lib/racecar/datadog.rb', line 65

def namespace=(namespace)
  @namespace = namespace
  clear
end

.portObject



43
44
45
# File 'lib/racecar/datadog.rb', line 43

def port
  @port
end

.port=(port) ⇒ Object



47
48
49
50
# File 'lib/racecar/datadog.rb', line 47

def port=(port)
  @port = port
  clear
end

.socket_pathObject



52
53
54
# File 'lib/racecar/datadog.rb', line 52

def socket_path
  @socket_path
end

.socket_path=(socket_path) ⇒ Object



56
57
58
59
# File 'lib/racecar/datadog.rb', line 56

def socket_path=(socket_path)
  @socket_path = socket_path
  clear
end

.statsdObject



21
22
23
24
25
26
27
# File 'lib/racecar/datadog.rb', line 21

def statsd
  @statsd ||= if socket_path
    ::Datadog::Statsd.new(socket_path: socket_path, namespace: namespace, tags: tags)
  else
    ::Datadog::Statsd.new(host, port, namespace: namespace, tags: tags)
  end
end

.statsd=(statsd) ⇒ Object



29
30
31
32
# File 'lib/racecar/datadog.rb', line 29

def statsd=(statsd)
  clear
  @statsd = statsd
end

.tagsObject



70
71
72
# File 'lib/racecar/datadog.rb', line 70

def tags
  @tags ||= []
end

.tags=(tags) ⇒ Object



74
75
76
77
# File 'lib/racecar/datadog.rb', line 74

def tags=(tags)
  @tags = tags
  clear
end