Class: OpenCensus::Trace::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/opencensus/trace/link.rb

Overview

A pointer from the current span to another span in the same trace or in a different trace. For example, this can be used in batching operations, where a single batch handler processes multiple requests from different traces or when the handler receives a request from a different project.

Constant Summary collapse

TYPE_UNSPECIFIED =

The relationship of the two spans is unknown, or known but other than parent-child.

:TYPE_UNSPECIFIED
CHILD_LINKED_SPAN =

The linked span is a child of the current span.

:CHILD_LINKED_SPAN
PARENT_LINKED_SPAN =

The linked span is a parent of the current span.

:PARENT_LINKED_SPAN

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_id, span_id, type: nil, attributes: {}, dropped_attributes_count: 0) ⇒ Link

Create a Link object.



80
81
82
83
84
85
86
87
# File 'lib/opencensus/trace/link.rb', line 80

def initialize trace_id, span_id, type: nil,
               attributes: {}, dropped_attributes_count: 0
  @trace_id = trace_id
  @span_id = span_id
  @type = type
  @attributes = attributes
  @dropped_attributes_count = dropped_attributes_count
end

Instance Attribute Details

#attributesHash<String, (TruncatableString, Integer, Boolean)> (readonly)

A set of attributes on the link.

Returns:



64
65
66
# File 'lib/opencensus/trace/link.rb', line 64

def attributes
  @attributes
end

#dropped_attributes_countInteger (readonly)

The number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0, then no attributes were dropped.

Returns:

  • (Integer)


73
74
75
# File 'lib/opencensus/trace/link.rb', line 73

def dropped_attributes_count
  @dropped_attributes_count
end

#span_idString (readonly)

A unique identifier for a span within a trace, assigned when the span is created. The ID is a 16-byte represented as a hexadecimal string.

Returns:

  • (String)


49
50
51
# File 'lib/opencensus/trace/link.rb', line 49

def span_id
  @span_id
end

#trace_idString (readonly)

A unique identifier for a trace. All spans from the same trace share the same ‘trace_id`. The ID is a 16-byte represented as a hexadecimal string.

Returns:

  • (String)


41
42
43
# File 'lib/opencensus/trace/link.rb', line 41

def trace_id
  @trace_id
end

#typeSymbol (readonly)

The relationship of the current span relative to the linked span. You should use the type constants provided by this class.

Returns:

  • (Symbol)


57
58
59
# File 'lib/opencensus/trace/link.rb', line 57

def type
  @type
end