module Interface
The console backend interface.
Definitions
def trace(name, resource: nil, attributes: {}, &block)
Trace the given block of code and log the execution.
Signature
-
parameter
name
String
A useful name/annotation for the recorded span.
-
parameter
attributes
Hash
Metadata for the recorded span.
Implementation
def trace(name, resource: nil, attributes: {}, &block)
context = Context.nested(Fiber.current.traces_backend_context)
Fiber.current.traces_backend_context = context
::Console.logger.info(resource || self, name, attributes)
if block.arity.zero?
yield
else
yield Span.new(context, name)
end
end
def trace_context= context
Assign a trace context to the current execution scope.
Implementation
def trace_context= context
Fiber.current.traces_backend_context = context
end
def trace_context
Get a trace context from the current execution scope.
Implementation
def trace_context
Fiber.current.traces_backend_context
end