Class: ActiveAgent::Telemetry::Span

Inherits:
ActiveAgents::Telemetry::Span
  • Object
show all
Defined in:
lib/active_agent/telemetry/span.rb

Overview

The framework's span, now provided by the activeagents-telemetry gem. This subclass translates the framework's historical constructor (span_type: keyword, attributes as a keyword splat) onto the shared class; everything else — set_attribute, set_tokens, set_status, record_error, add_span, measure, finish — is inherited.

One deliberate change rides along from the shared core: record_error truncates the message and no longer puts a backtrace on the wire.

See Also:

  • ActiveAgents::Telemetry::Span

Instance Method Summary collapse

Constructor Details

#initialize(name, trace_id:, parent_span_id: nil, span_type: :root, **attributes) ⇒ Span

Returns a new instance of Span.



16
17
18
19
20
21
22
23
24
# File 'lib/active_agent/telemetry/span.rb', line 16

def initialize(name, trace_id:, parent_span_id: nil, span_type: :root, **attributes)
  super(
    name,
    type: span_type,
    trace_id: trace_id,
    parent_span_id: parent_span_id,
    attributes: attributes
  )
end

Instance Method Details

#add_span(name, span_type: :root, **attributes) ⇒ Object

Creates a child span, keeping the framework's keyword shape.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/active_agent/telemetry/span.rb', line 27

def add_span(name, span_type: :root, **attributes)
  child = Span.new(
    name,
    trace_id: trace_id,
    parent_span_id: span_id,
    span_type: span_type,
    **attributes
  )
  children << child
  child
end