Class: Datadog::DefaultContextProvider
- Inherits:
-
Object
- Object
- Datadog::DefaultContextProvider
- 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
-
#context ⇒ Object
Return the current context.
-
#context=(ctx) ⇒ Object
Sets the current context.
-
#initialize ⇒ DefaultContextProvider
constructor
Initializes the default context provider with a thread-bound context.
Constructor Details
#initialize ⇒ DefaultContextProvider
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
#context ⇒ Object
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 |