Class: Aws::Telemetry::OTelContextManager

Inherits:
ContextManagerBase show all
Defined in:
lib/aws-sdk-core/telemetry/otel.rb

Overview

OpenTelemetry-based ContextManagerBase, manages context and used to return the current context within a trace.

Instance Method Summary collapse

Instance Method Details

#attach(context) ⇒ Object

Associates a Context with the caller’s current execution unit. Returns a token to be used with the matching call to detach.

Parameters:

  • context (Context)

    The new context

Returns:

  • (Object)

    token A token to be used when detaching



220
221
222
# File 'lib/aws-sdk-core/telemetry/otel.rb', line 220

def attach(context)
  OpenTelemetry::Context.attach(context)
end

#currentContext

Returns current context.

Returns:

  • (Context)


211
212
213
# File 'lib/aws-sdk-core/telemetry/otel.rb', line 211

def current
  OpenTelemetry::Context.current
end

#detach(token) ⇒ Boolean

Restore the previous Context associated with the current execution unit to the value it had before attaching a specified Context.

Parameters:

  • token (Object)

    The token provided by matching the call to attach

Returns:

  • (Boolean)

    ‘True` if the calls matched, `False` otherwise



230
231
232
# File 'lib/aws-sdk-core/telemetry/otel.rb', line 230

def detach(token)
  OpenTelemetry::Context.detach(token)
end