Method: Sentry::Span#initialize

Defined in:
lib/sentry/span.rb

#initialize(transaction:, description: nil, op: nil, status: nil, trace_id: nil, span_id: nil, parent_span_id: nil, sampled: nil, start_timestamp: nil, timestamp: nil, origin: nil) ⇒ Span

Returns a new instance of Span.

[View source]

117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/sentry/span.rb', line 117

def initialize(
  transaction:,
  description: nil,
  op: nil,
  status: nil,
  trace_id: nil,
  span_id: nil,
  parent_span_id: nil,
  sampled: nil,
  start_timestamp: nil,
  timestamp: nil,
  origin: nil
)
  @trace_id = trace_id || SecureRandom.uuid.delete("-")
  @span_id = span_id || SecureRandom.uuid.delete("-").slice(0, 16)
  @parent_span_id = parent_span_id
  @sampled = sampled
  @start_timestamp = start_timestamp || Sentry.utc_now.to_f
  @timestamp = timestamp
  @description = description
  @transaction = transaction
  @op = op
  @status = status
  @data = {}
  @tags = {}
  @origin = origin || DEFAULT_SPAN_ORIGIN
end