Module: Rails::Tracer::SpanHelpers

Defined in:
lib/rails/span_helpers.rb

Class Method Summary collapse

Class Method Details

.rack_span(payload) ⇒ Object



16
17
18
19
20
# File 'lib/rails/span_helpers.rb', line 16

def rack_span(payload)
  # if rack tracing is disabled, this will just be nil
  headers = payload.fetch(:headers, nil)
  headers.env['rack.span'] if !headers.nil?
end

.set_error(span, exception) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rails/span_helpers.rb', line 5

def set_error(span, exception)
  span.set_tag('error', true)

  case exception
  when Array
    exception_class, exception_message = exception
    span.log(event: 'error', :'error.kind' => exception_class, message: exception_message)
  when Exception
    span.log(event: 'error', :'error.object' => exception)
  end
end