Module: Logtide::Tracing

Defined in:
lib/logtide/tracing.rb,
lib/logtide/tracing/span.rb

Overview

W3C trace context: identifier generation and traceparent parsing/formatting (spec 005 sections 1-2).

Defined Under Namespace

Modules: Propagation Classes: Span

Class Method Summary collapse

Class Method Details

.generate_span_idObject



18
19
20
21
22
23
# File 'lib/logtide/tracing.rb', line 18

def generate_span_id
  loop do
    id = SecureRandom.hex(8)
    return id unless id.match?(/\A0+\z/)
  end
end

.generate_trace_idObject



11
12
13
14
15
16
# File 'lib/logtide/tracing.rb', line 11

def generate_trace_id
  loop do
    id = SecureRandom.hex(16)
    return id unless id.match?(/\A0+\z/)
  end
end