Class: Honeycomb::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/honeycomb/context.rb

Overview

Stores the current span and trace context

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#classic=(value) ⇒ Object (writeonly)

Sets the attribute classic

Parameters:

  • value

    the value to set the attribute classic to.



6
7
8
# File 'lib/honeycomb/context.rb', line 6

def classic=(value)
  @classic = value
end

Instance Method Details

#classic?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/honeycomb/context.rb', line 27

def classic?
  @classic
end

#current_spanObject



13
14
15
# File 'lib/honeycomb/context.rb', line 13

def current_span
  spans.last
end

#current_span=(span) ⇒ Object



17
18
19
# File 'lib/honeycomb/context.rb', line 17

def current_span=(span)
  spans << span
end

#current_traceObject



7
8
9
10
11
# File 'lib/honeycomb/context.rb', line 7

def current_trace
  return if current_span.nil?

  current_span.trace
end

#span_sent(span) ⇒ Object



21
22
23
24
25
# File 'lib/honeycomb/context.rb', line 21

def span_sent(span)
  spans.last != span && raise(ArgumentError, "Incorrect span sent")

  spans.pop
end