class OpenTelemetry::Trace::Link

A link to a {Span}. Used (for example) in batching operations, where a single batch handler processes multiple requests from different traces. A Link can be also used to reference spans from the same trace. A Link and its attributes are immutable.

Constants

EMPTY_ATTRIBUTES

Attributes

attributes[R]

Returns the frozen attributes for this link.

@return [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]

span_context[R]

Returns the {SpanContext} for this link

@return [SpanContext]

Public Class Methods

new(span_context, attributes = nil) click to toggle source

Returns a new immutable {Link}.

@param [SpanContext] span_context The context of the linked {Span}. @param [optional Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}]

attributes A hash of attributes for this link. Attributes will be
frozen during Link initialization.

@return [Link]

# File lib/opentelemetry/trace/link.rb, line 35
def initialize(span_context, attributes = nil)
  @span_context = span_context
  @attributes = attributes.freeze || EMPTY_ATTRIBUTES
end

Public Instance Methods

==(other) click to toggle source

Returns true if two {Link}s are equal.

# File lib/opentelemetry/trace/link.rb, line 41
def ==(other)
  other.span_context == @span_context && other.attributes == @attributes
end