Sha256: 2a83325de01d6a1a828ac5e4fbe905405343e8c563f830995b5b9fc87d8f3966
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true # Copyright 2019 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Trace # 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. class Link EMPTY_ATTRIBUTES = {}.freeze private_constant :EMPTY_ATTRIBUTES # Returns the {SpanContext} for this link # # @return [SpanContext] attr_reader :context # Returns the frozen attributes for this link. # # @return [Hash<String, Object>] attr_reader :attributes # Returns a new immutable {Link}. # # @param [SpanContext] span_context The context of the linked {Span}. # @param [optional Hash<String, Object>] attributes A hash of attributes for # this link. Attributes will be frozen during Link initialization. # @return [Link] def initialize(span_context, attributes = nil) @context = span_context @attributes = attributes.freeze || EMPTY_ATTRIBUTES end # Returns true if two {Link}s are equal. def ==(other) other.context == @context && other.attributes == @attributes end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opentelemetry-api-0.2.0 | lib/opentelemetry/trace/link.rb |