Module: Traces::Backend::Capture::Interface
- Defined in:
- lib/traces/backend/capture.rb
Instance Method Summary collapse
-
#trace(name, resource: nil, attributes: {}) {|span| ... } ⇒ Object
Trace the given block of code and log the execution.
-
#trace_context ⇒ Object
Get a trace context from the current execution scope.
-
#trace_context=(context) ⇒ Object
Assign a trace context to the current execution scope.
Instance Method Details
#trace(name, resource: nil, attributes: {}) {|span| ... } ⇒ Object
Trace the given block of code and log the execution.
61 62 63 64 65 66 67 68 69 |
# File 'lib/traces/backend/capture.rb', line 61 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 |
#trace_context ⇒ Object
Get a trace context from the current execution scope.
77 78 79 |
# File 'lib/traces/backend/capture.rb', line 77 def trace_context Fiber.current.traces_backend_context end |
#trace_context=(context) ⇒ Object
Assign a trace context to the current execution scope.
72 73 74 |
# File 'lib/traces/backend/capture.rb', line 72 def trace_context= context Fiber.current.traces_backend_context = context end |