class OpenTelemetry::Trace::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