Module: Yabeda::Datadog
- Defined in:
- lib/yabeda/datadog.rb,
lib/yabeda/datadog/tags.rb,
lib/yabeda/datadog/units.rb,
lib/yabeda/datadog/config.rb,
lib/yabeda/datadog/metric.rb,
lib/yabeda/datadog/worker.rb,
lib/yabeda/datadog/adapter.rb,
lib/yabeda/datadog/logging.rb,
lib/yabeda/datadog/version.rb,
lib/yabeda/datadog/exceptions.rb,
lib/yabeda/datadog/worker/send.rb,
lib/yabeda/datadog/worker/register.rb,
lib/yabeda/datadog/response_handler.rb
Overview
Namespace for DataDog adapter
Defined Under Namespace
Classes: Adapter, ApiKeyError, AppKeyError, Config, ConfigError, Logging, Metric, ResponseHandler, Tags, Unit, Worker
Constant Summary collapse
- SECOND =
1
- COLLECT_INTERVAL =
60 * SECOND
- VERSION =
"0.3.6"
Class Method Summary collapse
-
.config ⇒ Object
Gem configuration object.
-
.ensure_configured ⇒ Object
Check the gem configuration has valid state.
-
.start ⇒ Object
Prepare the adapter to work.
-
.start_exporter(collect_interval: COLLECT_INTERVAL) ⇒ Object
Start collection metrics from Yabeda collectors.
Class Method Details
.config ⇒ Object
Gem configuration object
19 20 21 |
# File 'lib/yabeda/datadog.rb', line 19 def config @config ||= Config.new end |
.ensure_configured ⇒ Object
Check the gem configuration has valid state
24 25 26 27 |
# File 'lib/yabeda/datadog.rb', line 24 def ensure_configured raise ApiKeyError unless config.api_key raise AppKeyError unless config.app_key end |
.start ⇒ Object
Prepare the adapter to work
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yabeda/datadog.rb', line 30 def start ensure_configured worker = Yabeda::Datadog::Worker.start(config) adapter = Yabeda::Datadog::Adapter.new(worker: worker) Yabeda.register_adapter(:datadog, adapter) adapter rescue ConfigError => e Logging.instance.warn e. nil end |
.start_exporter(collect_interval: COLLECT_INTERVAL) ⇒ Object
Start collection metrics from Yabeda collectors
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/yabeda/datadog.rb', line 42 def start_exporter(collect_interval: COLLECT_INTERVAL) Thread.new do Logging.instance.debug("initilize collectors harvest") loop do Logging.instance.debug("start collectors harvest") Yabeda.collectors.each(&:call) Logging.instance.debug("end collectors harvest") sleep(collect_interval) end end end |