Skip to content

chore: add notebook/MCP telemetry events - #593

Open
emrberk wants to merge 1 commit into
mainfrom
chore/add-notebook-events
Open

chore: add notebook/MCP telemetry events#593
emrberk wants to merge 1 commit into
mainfrom
chore/add-notebook-events

Conversation

@emrberk

@emrberk emrberk commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Adds console telemetry for notebooks and the MCP bridge so we can see how these features are actually used. No functional changes — every emit is a fire-and-forget trackEvent wrapped around existing handlers, batched through the existing IndexedDB send pipeline.

What's tracked

Notebook interactions — create/duplicate, layout mode, cell add/delete/duplicate/move/rename/run/draw, resize and size-reset (gesture end only, never per tick), view changes and maximize, chart settings (open/save/cancel, save-blocked, type change, reset-to-auto), markdown apply, variables popover, result-tab switching, onboarding modal funnel (open/step/close, including Escape/overlay dismissals).

MCP lifecycle — pairing prompted/accepted/declined (with granted permission level), manual pair, connect/disconnect/connect-failed, permissions changes, setup-command copy, agent-changes popper, status popover. Intentional teardowns (user disconnect, re-pair) are excluded from mcp.disconnected so the event only counts real drops.

MCP tool calls — one event per call, named per tool (mcp.add_cell, mcp.run_query, …), emitted after dispatch with an outcome (ok / denied / tool_error / dispatch_error / aborted), a denial reason code where applicable (permission vs. freshness gate), and duration. Unrecognized tool names emit mcp.unknown_tool with the name capped at 100 chars.

Implementation notes

  • Outcome classification lives in a new tested util (ConsoleEventTracker/mcpToolEvents.ts): it prefix-matches the known denial message constants and deliberately does not parse serialized tool results.
  • Tool-name → event mapping is derived from the enum values; unit tests cover classification, mapping, and the permission-level hierarchy.
  • Payloads are bounded enums, counts, and booleans only — no SQL text, table/cell names, variable values, tokens, or error messages leave the browser.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant