You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(telemetry): OTel-format ids and explicit session id
The local JSONL output exposed two schema rough edges. First, session_id
was vscode.env.sessionId verbatim, which is a UUID concatenated with a
ms timestamp ("0f465473-...-bed92cb4ed3a1777982179036"), looking like a
malformed UUID. Second, event_id and trace_id were UUIDv4 with hyphens,
not the lowercase-hex form OTel uses, so a future exporter would need a
translation layer for no real reason.
- Add src/telemetry/ids.ts with newTraceId (16 bytes / 32 hex),
newSpanId (8 bytes / 16 hex), and newSessionId (16 bytes / 32 hex).
Names and widths match OTel.
- buildSession takes sessionId as a parameter instead of reading
vscode.env.sessionId, decoupling our schema from VS Code's quirks.
- TelemetryService accepts sessionId in its constructor and forwards
it to buildSession.
- ServiceContainer generates one sessionId via newSessionId() and
threads it to both LocalJsonlSink (filename slug) and TelemetryService
(event payload), so the on-disk filename and the session_id field
always match.
- service.ts: replace crypto.randomUUID() with newSpanId / newTraceId
at every event emission.
- Tests updated for the new sessionId parameter and the new id format
regex (/^[0-9a-f]{16}$/ for event_id, sessionId is now an explicit
test fixture).
trace_id stays on every event (including single-event "traces"). You
cannot know at emit time whether a phase child will follow, and a
consistent schema is more valuable to consumers than 36 bytes per
event.
0 commit comments