Class: OpenTelemetry::Trace::Link
- Inherits:
-
Object
- Object
- OpenTelemetry::Trace::Link
- Defined in:
- lib/opentelemetry/trace/link.rb
Overview
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.
Instance Attribute Summary collapse
-
#attributes ⇒ Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}
readonly
Returns the frozen attributes for this link.
-
#span_context ⇒ SpanContext
readonly
Returns the SpanContext for this link.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Returns true if two Links are equal.
-
#initialize(span_context, attributes = nil) ⇒ Link
constructor
Returns a new immutable Link.
Constructor Details
#initialize(span_context, attributes = nil) ⇒ Link
Returns a new immutable OpenTelemetry::Trace::Link.
35 36 37 38 |
# File 'lib/opentelemetry/trace/link.rb', line 35 def initialize(span_context, attributes = nil) @span_context = span_context @attributes = attributes.freeze || EMPTY_ATTRIBUTES end |
Instance Attribute Details
#attributes ⇒ Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>} (readonly)
Returns the frozen attributes for this link.
26 27 28 |
# File 'lib/opentelemetry/trace/link.rb', line 26 def attributes @attributes end |
#span_context ⇒ SpanContext (readonly)
Returns the SpanContext for this link
21 22 23 |
# File 'lib/opentelemetry/trace/link.rb', line 21 def span_context @span_context end |
Instance Method Details
#==(other) ⇒ Object
Returns true if two OpenTelemetry::Trace::Links are equal.
41 42 43 |
# File 'lib/opentelemetry/trace/link.rb', line 41 def ==(other) other.span_context == @span_context && other.attributes == @attributes end |