module Kafka::Datadog
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.
Constants
- STATSD_NAMESPACE
Public Class Methods
host()
click to toggle source
# File lib/kafka/datadog.rb, line 42 def host @host end
host=(host)
click to toggle source
# File lib/kafka/datadog.rb, line 46 def host=(host) @host = host clear end
namespace()
click to toggle source
# File lib/kafka/datadog.rb, line 69 def namespace @namespace ||= STATSD_NAMESPACE end
namespace=(namespace)
click to toggle source
# File lib/kafka/datadog.rb, line 73 def namespace=(namespace) @namespace = namespace clear end
port()
click to toggle source
# File lib/kafka/datadog.rb, line 51 def port @port end
port=(port)
click to toggle source
# File lib/kafka/datadog.rb, line 55 def port=(port) @port = port clear end
socket_path()
click to toggle source
# File lib/kafka/datadog.rb, line 60 def socket_path @socket_path end
socket_path=(socket_path)
click to toggle source
# File lib/kafka/datadog.rb, line 64 def socket_path=(socket_path) @socket_path = socket_path clear end
statsd()
click to toggle source
# 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)
click to toggle source
# File lib/kafka/datadog.rb, line 37 def statsd=(statsd) clear @statsd = statsd end
Private Class Methods
clear()
click to toggle source
# File lib/kafka/datadog.rb, line 89 def clear @statsd && @statsd.close @statsd = nil end