Class: Yabeda::Datadog::Adapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- Yabeda::Datadog::Adapter
- Defined in:
- lib/yabeda/datadog/adapter.rb
Overview
DataDog adapter.
Sends yabeda metrics as custom metrics to DataDog. docs.datadoghq.com/integrations/ruby/
Instance Method Summary collapse
-
#initialize(worker:) ⇒ Adapter
constructor
A new instance of Adapter.
- #perform_counter_increment!(counter, tags, increment) ⇒ Object
- #perform_gauge_set!(gauge, tags, value) ⇒ Object
- #perform_histogram_measure!(historam, tags, value) ⇒ Object
- #register_counter!(counter) ⇒ Object
- #register_gauge!(gauge) ⇒ Object
- #register_histogram!(histogram) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(worker:) ⇒ Adapter
Returns a new instance of Adapter.
17 18 19 |
# File 'lib/yabeda/datadog/adapter.rb', line 17 def initialize(worker:) @worker = worker end |
Instance Method Details
#perform_counter_increment!(counter, tags, increment) ⇒ Object
25 26 27 28 29 |
# File 'lib/yabeda/datadog/adapter.rb', line 25 def perform_counter_increment!(counter, , increment) metric = Metric.new(counter, "count") = Tags.build() enqueue_send(metric, increment, ) end |
#perform_gauge_set!(gauge, tags, value) ⇒ Object
35 36 37 38 39 |
# File 'lib/yabeda/datadog/adapter.rb', line 35 def perform_gauge_set!(gauge, , value) metric = Metric.new(gauge, "gauge") = Tags.build() enqueue_send(metric, value, ) end |
#perform_histogram_measure!(historam, tags, value) ⇒ Object
47 48 49 50 51 |
# File 'lib/yabeda/datadog/adapter.rb', line 47 def perform_histogram_measure!(historam, , value) metric = Metric.new(historam, "histogram") = Tags.build() enqueue_send(metric, value, ) end |
#register_counter!(counter) ⇒ Object
21 22 23 |
# File 'lib/yabeda/datadog/adapter.rb', line 21 def register_counter!(counter) enqueue_register(Metric.new(counter, "rate")) end |
#register_gauge!(gauge) ⇒ Object
31 32 33 |
# File 'lib/yabeda/datadog/adapter.rb', line 31 def register_gauge!(gauge) enqueue_register(Metric.new(gauge, "gauge")) end |
#register_histogram!(histogram) ⇒ Object
41 42 43 44 45 |
# File 'lib/yabeda/datadog/adapter.rb', line 41 def register_histogram!(histogram) Metric.histogram_metrics(histogram).map do |historgam_sub_metric| enqueue_register(historgam_sub_metric) end end |
#stop ⇒ Object
53 54 55 |
# File 'lib/yabeda/datadog/adapter.rb', line 53 def stop worker.stop end |