Module: Datadog::Tracing::Metadata::Errors

Defined in:
lib/datadog/tracing/metadata/errors.rb

Overview

Adds error tagging behavior

Instance Method Summary collapse

Instance Method Details

#set_error(e) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/datadog/tracing/metadata/errors.rb', line 13

def set_error(e)
  Datadog::Core.log_deprecation do
    'Errors.set_error(..) is deprecated. ' \
    'Use Errors.set_error_tags(..) instead.'
  end
  set_error_tags(e)
end

#set_error_tags(e) ⇒ Object

Mark the span with the given error.



22
23
24
25
26
27
28
# File 'lib/datadog/tracing/metadata/errors.rb', line 22

def set_error_tags(e)
  e = Core::Error.build_from(e)

  set_tag(Ext::Errors::TAG_TYPE, e.type) unless e.type.empty?
  set_tag(Ext::Errors::TAG_MSG, e.message) unless e.message.empty?
  set_tag(Ext::Errors::TAG_STACK, e.backtrace) unless e.backtrace.empty?
end