class OpenTelemetry::Trace::Span
{Span} must be ended by calling {#finish}.
mechanism.
prevents the mis-use of spans as an in-process information propagation
resulting status. Span cannot be used to retrieve these properties. This
add additional properties to it like attributes, links, events, name and
Once Span {Tracer#start_span is created} - Span operations can be used to
sub-operations.
end-to-end latency and, optionally, one or more sub-spans for its
form a trace tree. Often, a trace contains a root span that describes the
Span represents a single operation within a trace. Spans can be nested to
def add_attributes(attributes)
-
(self)
- returns itself
Parameters:
-
attributes
(Hash{String => String, Numeric, Boolean, Array
) --}
def add_attributes(attributes) self end
def add_event(name, attributes: nil, timestamp: nil)
-
(self)
- returns itself
Parameters:
-
timestamp
(optional Time
) -- Optional timestamp for the event. -
(
optional Hash{String => String, Numeric, Boolean, Array
) --} -
name
(String
) -- Name of the event.
def add_event(name, attributes: nil, timestamp: nil) self end
def add_link(link)
-
(self)
- returns itself
Parameters:
-
the
(OpenTelemetry::Trace::Link
) -- link object to add on the {Span}.
def add_link(link) self end
def finish(end_timestamp: nil)
-
(self)
- returns itself
Parameters:
-
end_timestamp
(Time
) -- optional end timestamp for the span.
def finish(end_timestamp: nil) self end
def initialize(span_context: nil)
- Api: - private
def initialize(span_context: nil) @context = span_context || SpanContext.new end
def name=(new_name); end
-
(void)
-
Parameters:
-
new_name
(String
) -- The new operation name, which supersedes
def name=(new_name); end
def record_exception(exception, attributes: nil); end
-
(void)
-
Parameters:
-
(
optional Hash{String => String, Numeric, Boolean, Array
) --} -
exception
(Exception
) -- The exception to recorded
def record_exception(exception, attributes: nil); end
def recording?
-
(Boolean)
- true if this Span is active and recording information
def recording? false end
def set_attribute(key, value)
-
(self)
- returns itself
Parameters:
-
value
(String, Boolean, Numeric, Array
) -- -
key
(String
) --
def set_attribute(key, value) self end
def status=(status); end
-
(void)
-
Parameters:
-
status
(Status
) -- The new status, which overrides the default Span
def status=(status); end