Module: Yabeda::Statsd
- Defined in:
- lib/yabeda/statsd.rb,
lib/yabeda/statsd/tags.rb,
lib/yabeda/statsd/config.rb,
lib/yabeda/statsd/adapter.rb,
lib/yabeda/statsd/version.rb
Overview
Namespace for Statsd adapter
Defined Under Namespace
Classes: Adapter, Config, Tags
Constant Summary collapse
- VERSION =
"0.1.2"
Class Method Summary collapse
- .config ⇒ Object
- .configure(&block) ⇒ Object
- .start(logger: nil) ⇒ Object
-
.start_exporter ⇒ Object
Start collection metrics from Yabeda collectors.
Class Method Details
.config ⇒ Object
16 17 18 |
# File 'lib/yabeda/statsd.rb', line 16 def config Yabeda::Statsd::Config.config end |
.configure(&block) ⇒ Object
12 13 14 |
# File 'lib/yabeda/statsd.rb', line 12 def configure(&block) class_exec(&block) end |
.start(logger: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/yabeda/statsd.rb', line 20 def start(logger: nil) connection = ::Datadog::Statsd.new( Yabeda::Statsd.config.statsd_host, Yabeda::Statsd.config.statsd_port, logger: logger, ) adapter = Yabeda::Statsd::Adapter.new(connection: connection) Yabeda.register_adapter(:statsd, adapter) adapter end |
.start_exporter ⇒ Object
Start collection metrics from Yabeda collectors
32 33 34 35 36 37 38 39 |
# File 'lib/yabeda/statsd.rb', line 32 def start_exporter Thread.new do loop do Yabeda.collectors.each(&:call) sleep(config.collect_interval) end end end |