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"
Kafka::Datadog.namespace = "custom-namespace"
Kafka::Datadog.host = "statsd.something.com"
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, ProducerSubscriber, StatsdSubscriber
Constant Summary
collapse
- STATSD_NAMESPACE =
"ruby_kafka"
Class Method Summary
collapse
Class Method Details
.host ⇒ Object
35
36
37
|
# File 'lib/kafka/datadog.rb', line 35
def host
@host ||= ::Datadog::Statsd::DEFAULT_HOST
end
|
.host=(host) ⇒ Object
39
40
41
42
|
# File 'lib/kafka/datadog.rb', line 39
def host=(host)
@host = host
clear
end
|
.namespace ⇒ Object
53
54
55
|
# File 'lib/kafka/datadog.rb', line 53
def namespace
@namespace ||= STATSD_NAMESPACE
end
|
.namespace=(namespace) ⇒ Object
57
58
59
60
|
# File 'lib/kafka/datadog.rb', line 57
def namespace=(namespace)
@namespace = namespace
clear
end
|
.port ⇒ Object
44
45
46
|
# File 'lib/kafka/datadog.rb', line 44
def port
@port ||= ::Datadog::Statsd::DEFAULT_PORT
end
|
.port=(port) ⇒ Object
48
49
50
51
|
# File 'lib/kafka/datadog.rb', line 48
def port=(port)
@port = port
clear
end
|
.statsd ⇒ Object
31
32
33
|
# File 'lib/kafka/datadog.rb', line 31
def statsd
@statsd ||= ::Datadog::Statsd.new(host, port, namespace: namespace, tags: tags)
end
|
62
63
64
|
# File 'lib/kafka/datadog.rb', line 62
def tags
@tags ||= []
end
|
66
67
68
69
|
# File 'lib/kafka/datadog.rb', line 66
def tags=(tags)
@tags = tags
clear
end
|