Class: Insika::Telemetry::OTelTracer

Inherits:
Object
  • Object
show all
Defined in:
lib/insika/telemetry.rb

Overview

Translates the Recorder's duck-typed contract to the OTEL tracer.

Instance Method Summary collapse

Constructor Details

#initialize(otel) ⇒ OTelTracer

Returns a new instance of OTelTracer.



110
# File 'lib/insika/telemetry.rb', line 110

def initialize(otel) = (@otel = otel)

Instance Method Details

#start_span(name, parent:, attributes:, start_time:) ⇒ Object



112
113
114
115
# File 'lib/insika/telemetry.rb', line 112

def start_span(name, parent:, attributes:, start_time:)
  ctx = parent ? OpenTelemetry::Trace.context_with_span(parent.raw) : OpenTelemetry::Context.current
  OTelSpan.new(@otel.start_span(name, with_parent: ctx, attributes: attributes, start_timestamp: start_time))
end