Module: OpenTelemetry::Trace
- Defined in:
- lib/opentelemetry/trace.rb,
lib/opentelemetry/trace/link.rb,
lib/opentelemetry/trace/span.rb,
lib/opentelemetry/trace/event.rb,
lib/opentelemetry/trace/status.rb,
lib/opentelemetry/trace/tracer.rb,
lib/opentelemetry/trace/span_kind.rb,
lib/opentelemetry/trace/trace_flags.rb,
lib/opentelemetry/trace/span_context.rb,
lib/opentelemetry/trace/sampling_hint.rb,
lib/opentelemetry/trace/tracer_factory.rb
Overview
The Trace API allows recording a set of events, triggered as a result of a single logical operation, consolidated across various components of an application.
Defined Under Namespace
Modules: SamplingHint, SpanKind Classes: Event, Link, Span, SpanContext, Status, TraceFlags, Tracer, TracerFactory
Constant Summary collapse
- INVALID_TRACE_ID =
An invalid trace identifier, a 16-byte array with all zero bytes, encoded as a hexadecimal string.
('0' * 32).freeze
- INVALID_SPAN_ID =
An invalid span identifier, an 8-byte array with all zero bytes, encoded as a hexadecimal string.
('0' * 16).freeze
Class Method Summary collapse
-
.generate_span_id ⇒ String
Generates a valid span identifier, an 8-byte array with at least one non-zero byte, encoded as a hexadecimal string.
-
.generate_trace_id ⇒ String
Generates a valid trace identifier, a 16-byte array with at least one non-zero byte, encoded as a hexadecimal string.
Class Method Details
.generate_span_id ⇒ String
Generates a valid span identifier, an 8-byte array with at least one non-zero byte, encoded as a hexadecimal string.
35 36 37 38 39 40 |
# File 'lib/opentelemetry/trace.rb', line 35 def self.generate_span_id loop do id = Random::DEFAULT.bytes(8).unpack1('H*') return id unless id == INVALID_SPAN_ID end end |
.generate_trace_id ⇒ String
Generates a valid trace identifier, a 16-byte array with at least one non-zero byte, encoded as a hexadecimal string.
24 25 26 27 28 29 |
# File 'lib/opentelemetry/trace.rb', line 24 def self.generate_trace_id loop do id = Random::DEFAULT.bytes(16).unpack1('H*') return id unless id == INVALID_TRACE_ID end end |