Method: ElasticAPM::Span#initialize

Defined in:
lib/elastic_apm/span.rb

#initialize(name:, transaction:, trace_context:, parent:, type: nil, subtype: nil, action: nil, context: nil, stacktrace_builder: nil, sync: nil, exit_span: false) ⇒ Span

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/ParameterLists



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/elastic_apm/span.rb', line 42

def initialize(
  name:,
  transaction:,
  trace_context:,
  parent:,
  type: nil,
  subtype: nil,
  action: nil,
  context: nil,
  stacktrace_builder: nil,
  sync: nil,
  exit_span: false
)
  @name = name

  if subtype.nil? && type&.include?('.')
    @type, @subtype, @action = type.split('.')
  else
    @type = type || DEFAULT_TYPE
    @subtype = subtype
    @action = action
  end

  @transaction = transaction
  @parent = parent
  @trace_context = trace_context || parent.trace_context.child
  @sample_rate = transaction.sample_rate

  @context = context || Span::Context.new(sync: sync)
  @stacktrace_builder = stacktrace_builder

  @exit_span = exit_span
end