Class: Deimos::Tracing::Datadog
- Defined in:
- lib/deimos/tracing/datadog.rb
Overview
Tracing wrapper class for Datadog.
Instance Method Summary collapse
-
#active_span ⇒ Object
:nodoc:.
-
#finish(span) ⇒ Object
:nodoc:.
-
#initialize(config) ⇒ Datadog
constructor
A new instance of Datadog.
-
#set_error(span, exception) ⇒ Object
:nodoc:.
-
#set_tag(tag, value, span = nil) ⇒ Object
:nodoc:.
-
#start(span_name, options = {}) ⇒ Object
:nodoc:.
Constructor Details
#initialize(config) ⇒ Datadog
Returns a new instance of Datadog.
10 11 12 13 14 |
# File 'lib/deimos/tracing/datadog.rb', line 10 def initialize(config) raise 'Tracing config must specify service_name' if config[:service_name].nil? @service = config[:service_name] end |
Instance Method Details
#active_span ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/deimos/tracing/datadog.rb', line 34 def active_span ::Datadog.tracer.active_span end |
#finish(span) ⇒ Object
:nodoc:
29 30 31 |
# File 'lib/deimos/tracing/datadog.rb', line 29 def finish(span) span.finish end |
#set_error(span, exception) ⇒ Object
:nodoc:
39 40 41 |
# File 'lib/deimos/tracing/datadog.rb', line 39 def set_error(span, exception) span.set_error(exception) end |
#set_tag(tag, value, span = nil) ⇒ Object
:nodoc:
44 45 46 |
# File 'lib/deimos/tracing/datadog.rb', line 44 def set_tag(tag, value, span=nil) (span || active_span).set_tag(tag, value) end |
#start(span_name, options = {}) ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deimos/tracing/datadog.rb', line 17 def start(span_name, ={}) span = if ::Datadog.respond_to?(:tracer) ::Datadog.tracer.trace(span_name) else ::Datadog::Tracing.trace(span_name) end span.service = @service span.resource = [:resource] span end |