Closed Bug 2019764 Opened 4 months ago Closed 4 months ago

[meta] Smart Window E2E Telemetry Flow

Categories

(Core :: Machine Learning: Frontend, task)

task

Tracking

()

RESOLVED DUPLICATE of bug 2000687

People

(Reporter: thasan, Unassigned)

Details

(Keywords: meta)

End-to-end telemetry observability for Smart Window using MLTelemetry's flow_id

Problem
There is currently no way to trace a single user turn end-to-end: from UI submission, through engine creation, the OpenAI streaming pipeline, tool call execution, and into backend logs. The two Glean categories (smart_window.* and firefox_ai_runtime.*) are disconnected.

Plan
MLTelemetry [1] already manages flow_id UUIDs and records firefox_ai_runtime.session_start/end, engine_run, and inference events. The plan is to instantiate MLTelemetry per-turn in ai-window.mjs so the same flow_id appears on:

  • smart_window.* events (product/UI layer)
  • firefox_ai_runtime.* events (ML runtime layer, recorded automatically by the engine)
  • Backend request logs (via the X-Flow-ID HTTP header)

This enables Redash dashboards that join frontend and backend data on flow_id, grouped into conversations by chat_id.

Correlation Model

  • chat_id: Conversation-scoped UUID (long-lived, groups all turns).
  • flow_id: Turn-scoped UUID from MLTelemetry (short-lived, traces one request-response cycle end-to-end across both Glean categories).
  • message_seq: Sequential turn index within a conversation.

Events during a model turn carry flow_id. Pure UI events (open_window, sidebar_open, mention_start, etc.) use only chat_id + message_seq. Post-turn events (feedback, link_click) read a stashed flow_id from the ChatMessage.

References
[1] MLTelemetry class: https://searchfox.org/firefox-main/source/toolkit/components/ml/MLTelemetry.sys.mjs
[2] Telemetry naming doc: https://docs.google.com/document/d/1EtlLGvLTSidFRoMMXGLLaNcxpYHjU-L5jYK7N88EGhw
[3] Chat.fetchWithHistory: https://searchfox.org/firefox-main/source/browser/components/aiwindow/models/Chat.sys.mjs#64
[4] ai-window.mjs #fetchAIResponse: https://searchfox.org/firefox-main/source/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs#861

Status: NEW → RESOLVED
Closed: 4 months ago
Duplicate of bug: 2000687
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.