class OpenTelemetry::Trace::Tracer
No-op implementation of Tracer.
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
- Yield: - yields the newly created span and a context containing the
Parameters:
-
kind
(optional Symbol
) -- One of :internal, :server, :client, :producer, :consumer -
start_timestamp
(optional Integer
) -- nanoseconds since Epoch -
links
(optional Array
) -- an array of OpenTelemetry::Trace::Link instances -
attributes
(optional Hash
) -- attributes to attach to the span {String => String, -
name
(String
) -- the name of the span
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) span = nil span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind) Trace.with_span(span) { |s, c| yield s, c } rescue Exception => e # rubocop:disable Lint/RescueException span&.record_exception(e) span&.status = Status.error("Unhandled exception of type: #{e.class}") raise e ensure span&.finish end
def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
def start_root_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil) Span::INVALID end
def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
-
(Span)
-
Parameters:
-
with_parent
(optional Context
) -- Explicitly managed parent context
def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil) span = OpenTelemetry::Trace.current_span(with_parent) if span.context.valid? span else Span::INVALID end end