Skip to content

TraceCommand

Category: Commands

Source: trace_command.dart

Classes

TraceExportResult

Outcome of glue trace export. Returned by [exportSessionTrace] so the Command<int> layer can render it via [formatTraceExportResult] without owning any I/O logic itself.

Constructor

dart
const TraceExportResult({
    required this.sessionId,
    required this.outputPath,
    required this.spanCount,
    required this.droppedInFlight,
    required this.scannedLogFiles,
  })

Properties

PropertyTypeDescription
sessionIdString
outputPathString
spanCountintNumber of completed spans written as Complete (X) events. Excludes per-span Instant child events and M metadata events.
droppedInFlightintSpans that fell within the session window but had no end_time — they were in flight when the log was sampled and cannot be Complete events.
scannedLogFilesList<String>spans-*.jsonl files whose date range overlapped the session window. Empty when the session left no spans on disk (e.g. early crash before the file sink wrote anything).

TraceExportException

Constructor

dart
TraceExportException(this.message)

Properties

PropertyTypeDescription
messageString

Methods

String toString()

TraceCommand

glue trace … — convert recorded observability spans into a Firefox Profiler–compatible trace file (Chrome Trace Event Format). The conversion reads $GLUE_HOME/logs/ spans-*.jsonl produced by FileSink and filters to one session via its meta.json time range.

Constructor

dart
TraceCommand()

Properties

PropertyTypeDescription
nameString get
descriptionString get
nameString get
descriptionString get

TraceExportCommand

Constructor

dart
TraceExportCommand()

Properties

PropertyTypeDescription
nameString get
descriptionString get
invocationString get
nameString get
descriptionString get
invocationString get

Methods

Future<int> run()

Functions

`TraceExportResult exportSessionTrace({

required Environment env, required String sessionId, String? outputPath, })`

Resolves [sessionId] to a session on disk, scans logsDir for spans that fall within the session window, converts them with [spansToChromeTrace], and writes the result to [outputPath] (defaulting to <sessionDir>/trace.json).

Time-range filtering — rather than per-span session.id matching — keeps this command zero-cost: it reads existing JSONL without any upstream changes to span emission. Sound today because Glue runs one session per process; revisit when that stops being true.

SessionMeta? findLatestSession(Environment env)

Newest session by start_time. null when sessionsDir is empty.

Released under the MIT License.