class Datadog::DefaultContextProvider

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

Public Class Methods

new() click to toggle source

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

# File lib/ddtrace/context_provider.rb, line 7
def initialize
  @context = ThreadLocalContext.new
end

Public Instance Methods

context() click to toggle source

Return the current context.

# File lib/ddtrace/context_provider.rb, line 17
def context
  @context.local
end
context=(ctx) click to toggle source

Sets the current context.

# File lib/ddtrace/context_provider.rb, line 12
def context=(ctx)
  @context.local = ctx
end