Use when adding, modifying, or debugging OTel span timeline events in the trace view. Covers event structure, ClickHouse storage constraints, rendering in SpanT
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-span-timeline-events-f6b854ff892d ,按照其中的说明把「span-timeline-events」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
The trace view's right panel shows a timeline of events for the selected span. These are OTel span events rendered by app/utils/timelineSpanEvents.ts and the SpanTimeline component.
kind: "SPAN_EVENT" sharing the parent span's span_id. The #mergeRecordsIntoSpanDetail method reassembles them into the span's events array at query time.name starts with trigger.dev/ - all others are silently filtered out.properties.event (not the span event name), mapped through getFriendlyNameForEvent().When events are written to ClickHouse, spanEventsToTaskEventV1Input() filters out events whose start_time is not greater than the parent span's startTime. Events at or before the span start are silently dropped. This means span events must have timestamps strictly after the span's own startTimeUnixNano.
The SpanTimeline component in app/components/run/RunTimeline.tsx renders:
createTimelineSpanEventsFromSpanEvents()startTimestartTime + durationThe thin line before "Started" only appears when there are events with timestamps between the span start and the first child span. For the Attempt span this works well (Dequeued -> Pod scheduled -> Launched -> etc. all happen before execution starts). Events all get lineVariant: "light" (thin) while the execution bar gets variant: "normal" (thick).
Sibling spans (same parent) are sorted by start_time ASC from the ClickHouse query. The createTreeFromFlatItems function preserves this order. Event timestamps don't affect sort order - only the span's own start_time.
// OTel span event format
{
name: "trigger.dev/run", // Must start with "trigger.dev/" to render
timeUnixNano: "1711200000000000000",
attributes: [
{ key: "event", value: { stringValue: "dequeue" } }, // The actual event type
{ key: "duration", value: { intValue: 150 } }, // Optional: duration in ms
]
}
getAdminOnlyForEvent() controls visibility. Events default to admin-only (true).
| Event | Admin-only | Friendly name |
|---|---|---|
dequeue | No | Dequeued |
fork | No | Launched |
import | No (if no fork event) | Importing task file |
create_attempt | Yes | Attempt created |
lazy_payload | Yes | Lazy attempt initialized |
pod_scheduled | Yes | Pod scheduled |
| (default) | Yes | (raw event name) |
name: "trigger.dev/<scope>" and properties.event: "<type>"startTimeUnixNano (ClickHouse drops earlier events)getFriendlyNameForEvent() in app/utils/timelineSpanEvents.tsgetAdminOnlyForEvent()getHelpTextForEvent()app/utils/timelineSpanEvents.ts - filtering, naming, admin logicapp/components/run/RunTimeline.tsx - SpanTimeline component (thin line + thick bar rendering)app/presenters/v3/SpanPresenter.server.ts - loads span data including eventsapp/v3/eventRepository/clickhouseEventRepository.server.ts - spanEventsToTaskEventV1Input() (storage filter), #mergeRecordsIntoSpanDetail (reassembly)