Class: Skywalking::Tracing::ExitSpan

Inherits:
Span
  • Object
show all
Defined in:
lib/skywalking/tracing/exit_span.rb

Instance Attribute Summary

Attributes inherited from Span

#component, #context, #end_time, #error_occurred, #inherit, #kind, #layer, #operation, #parent_id, #peer, #refs, #span_id, #stack_depth, #start_time, #tags

Instance Method Summary collapse

Methods inherited from Span

#extract, #finish?, #start, #stop?, #tag, #tags_item

Constructor Details

#initialize(context:, span_id: -1,, parent_id: -1,, operation: nil, peer: nil, component: nil, layer: nil) ⇒ ExitSpan

Returns a new instance of ExitSpan.



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/skywalking/tracing/exit_span.rb', line 21

def initialize(
  context:,
  span_id: -1,
  parent_id: -1,
  operation: nil,
  peer: nil,
  component: nil,
  layer: nil
)
  super(context: context, span_id: span_id, parent_id: parent_id,
        operation: operation, peer: peer, kind: Kind::Exit,
        component: component, layer: layer)
end

Instance Method Details

#cfgObject



35
36
37
# File 'lib/skywalking/tracing/exit_span.rb', line 35

def cfg
  @config ||= ::Skywalking::Agent.agent_config
end

#injectObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/skywalking/tracing/exit_span.rb', line 39

def inject
  Carrier.new(
    trace_id: @context.segment.related_traces[0].to_s,
    segment_id: @context.segment.segment_id.to_s,
    span_id: @span_id.to_s,
    service: cfg[:service_name],
    service_instance: cfg[:instance_name],
    endpoint: @operation,
    peer: @peer,
    correlation: @context.correlation
  )
end