Class: Datadog::SpanBuffer
- Inherits:
-
Object
- Object
- Datadog::SpanBuffer
- Defined in:
- lib/ddtrace/buffer.rb
Overview
Buffer used to store active spans
Instance Method Summary collapse
-
#get ⇒ Object
Return the current active span or nil.
-
#initialize ⇒ SpanBuffer
constructor
ensure that a new SpanBuffer clears the thread spans.
-
#pop ⇒ Object
Pop the current active span.
-
#set(span) ⇒ Object
Set the current active span.
Constructor Details
#initialize ⇒ SpanBuffer
ensure that a new SpanBuffer clears the thread spans
7 8 9 |
# File 'lib/ddtrace/buffer.rb', line 7 def initialize Thread.current[:datadog_span] = nil end |
Instance Method Details
#get ⇒ Object
Return the current active span or nil.
17 18 19 |
# File 'lib/ddtrace/buffer.rb', line 17 def get Thread.current[:datadog_span] end |
#pop ⇒ Object
Pop the current active span.
22 23 24 25 26 |
# File 'lib/ddtrace/buffer.rb', line 22 def pop span = get() set(nil) span end |
#set(span) ⇒ Object
Set the current active span.
12 13 14 |
# File 'lib/ddtrace/buffer.rb', line 12 def set(span) Thread.current[:datadog_span] = span end |