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, ProducerSubscriber, StatsdSubscriber

Constant Summary collapse

STATSD_NAMESPACE =
"ruby_kafka"

Class Method Summary collapse

Class Method Details

.host=(host) ⇒ Object


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

def self.host=(host)
  statsd.host = host
end

.namespace=(namespace) ⇒ Object


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

def self.namespace=(namespace)
  statsd.namespace = namespace
end

.port=(port) ⇒ Object


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

def self.port=(port)
  statsd.port = port
end

.statsdObject


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

def self.statsd
  @statsd ||= ::Datadog::Statsd.new(::Datadog::Statsd::DEFAULT_HOST, ::Datadog::Statsd::DEFAULT_PORT, namespace: STATSD_NAMESPACE)
end

.tags=(tags) ⇒ Object


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

def self.tags=(tags)
  statsd.tags = tags
end