Class: Slimy::Reporters::DatadogReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- Slimy::Reporters::DatadogReporter
- Defined in:
- lib/slimy/reporters/datadog.rb
Overview
Reporter for sending data to datadog
this requires a DogstatsD instance to operate
Instance Method Summary collapse
-
#initialize(dogstatsd) ⇒ DatadogReporter
constructor
A new instance of DatadogReporter.
-
#report(context) ⇒ Object
report the given context to datadog.
- #set_tags_on_span(context, sli_status, current_span) ⇒ Object
Constructor Details
#initialize(dogstatsd) ⇒ DatadogReporter
Returns a new instance of DatadogReporter.
10 11 12 |
# File 'lib/slimy/reporters/datadog.rb', line 10 def initialize(dogstatsd) @dogstatsd = dogstatsd end |
Instance Method Details
#report(context) ⇒ Object
report the given context to datadog
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/slimy/reporters/datadog.rb', line 15 def report(context) return unless context.reportable? sli_status = (context.success? ? "success" : "failure") current_span = Datadog.tracer.active_span if current_span.nil? Rails.logger.debug("COULD NOT FIND SPAN") else (context, sli_status, current_span) @dogstatsd.increment("sli.#{context.type}.#{sli_status}", tags: context.) end end |
#set_tags_on_span(context, sli_status, current_span) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/slimy/reporters/datadog.rb', line 29 def (context, sli_status, current_span) current_span.set_tag("sli_status", sli_status) current_span.set_tag("sli_deadline", context.deadline) context..each_pair do |key, value| current_span.set_tag(key, value) end end |