Class: Datadog::DefaultContextProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/ddtrace/provider.rb

Overview

DefaultContextProvider is a default context provider that retrieves all contexts from the current thread-local storage. It is suitable for synchronous programming.

Instance Method Summary collapse

Constructor Details

#initializeDefaultContextProvider

Initializes the default context provider with a thread-bound context.



7
8
9
# File 'lib/ddtrace/provider.rb', line 7

def initialize
  @context = Datadog::ThreadLocalContext.new
end

Instance Method Details

#contextObject

Return the current context.



17
18
19
# File 'lib/ddtrace/provider.rb', line 17

def context
  @context.local
end

#context=(ctx) ⇒ Object

Sets the current context.



12
13
14
# File 'lib/ddtrace/provider.rb', line 12

def context=(ctx)
  @context.local = ctx
end