Skip to content

TraceSpan

A single trace span capturing one pipeline stage or function invocation. Spans nest via the __frames field to form a tree representing the full execution (§3.6.1).

---
title: TraceSpan
config:
  look: handDrawn
  theme: colorful
  class:
    hideEmptyMembersBox: true
---
classDiagram
    class TraceSpan {
        +string name
        +TraceTime __time
        +string signature
        +dictionary inputs
        +unknown output
        +string error
        +TokenUsage __usage
        +dictionary attributes
        +unknown[] __frames
    }
    class TraceTime {
        +string start
        +string end
        +float64 duration
    }
    TraceSpan *-- TraceTime
    class TokenUsage {
        +int32 promptTokens
        +int32 completionTokens
        +int32 totalTokens
    }
    TraceSpan *-- TokenUsage
name: prompty.core.pipeline.run
signature: prompty.core.pipeline.run
error: Connection refused
NameTypeDescription
namestringThe name of this span (typically the function signature)
__timeTraceTimeTiming information for this span
signaturestringFully-qualified function signature that produced this span
inputsdictionarySerialized input parameters (redacted per §3.4)
outputunknownSerialized return value or error information (redacted per §3.4)
errorstringError message if the span ended with an exception
__usageTokenUsageAggregated token usage hoisted from child spans (§3.5)
attributesdictionaryAdditional span attributes (e.g., OpenTelemetry GenAI attributes)
__framesunknown[]Nested child spans forming the execution tree (recursive; each element is a TraceSpan)

The following types are composed within TraceSpan: