module Traces::Backend::Capture::Interface

def trace(name, resource: nil, attributes: {}, &block)

@parameter attributes [Hash] Metadata for the recorded span.
@parameter name [String] A useful name/annotation for the recorded span.
Trace the given block of code and log the execution.
def trace(name, resource: nil, attributes: {}, &block)
	context = Context.nested(Fiber.current.traces_backend_context)
	Fiber.current.traces_backend_context = context
	
	span = Span.new(context, name, resource, attributes)
	Capture.spans << span
	
	yield span
end

def trace_context

Get a trace context from the current execution scope.
def trace_context
	Fiber.current.traces_backend_context
end

def trace_context= context

Assign a trace context to the current execution scope.
def trace_context= context
	Fiber.current.traces_backend_context = context
end