Module: Kafka::Datadog

Defined in:
lib/kafka/datadog.rb

Overview

Reports operational metrics to a Datadog agent using the modified Statsd protocol.

require "kafka/datadog"

# Default is "ruby_kafka".
Kafka::Datadog.namespace = "custom-namespace"

# Default is "127.0.0.1".
Kafka::Datadog.host = "statsd.something.com"

# Default is 8125.
Kafka::Datadog.port = 1234

Once the file has been required, no further configuration is needed – all operational metrics are automatically emitted.

Defined Under Namespace

Classes: AsyncProducerSubscriber, ConnectionSubscriber, ConsumerSubscriber, FetcherSubscriber, ProducerSubscriber, StatsdSubscriber

Constant Summary collapse

STATSD_NAMESPACE =
"ruby_kafka"

Class Method Summary collapse

Class Method Details

.hostObject



42
43
44
# File 'lib/kafka/datadog.rb', line 42

def host
  @host
end

.host=(host) ⇒ Object



46
47
48
49
# File 'lib/kafka/datadog.rb', line 46

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

.namespaceObject



69
70
71
# File 'lib/kafka/datadog.rb', line 69

def namespace
  @namespace ||= STATSD_NAMESPACE
end

.namespace=(namespace) ⇒ Object



73
74
75
76
# File 'lib/kafka/datadog.rb', line 73

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

.portObject



51
52
53
# File 'lib/kafka/datadog.rb', line 51

def port
  @port
end

.port=(port) ⇒ Object



55
56
57
58
# File 'lib/kafka/datadog.rb', line 55

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

.socket_pathObject



60
61
62
# File 'lib/kafka/datadog.rb', line 60

def socket_path
  @socket_path
end

.socket_path=(socket_path) ⇒ Object



64
65
66
67
# File 'lib/kafka/datadog.rb', line 64

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

.statsdObject



33
34
35
# File 'lib/kafka/datadog.rb', line 33

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

.statsd=(statsd) ⇒ Object



37
38
39
40
# File 'lib/kafka/datadog.rb', line 37

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

.tagsObject



78
79
80
# File 'lib/kafka/datadog.rb', line 78

def tags
  @tags ||= []
end

.tags=(tags) ⇒ Object



82
83
84
85
# File 'lib/kafka/datadog.rb', line 82

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