Skip to content

Add MySQL trace functionality#2

Open
epli2 wants to merge 2 commits intomainfrom
claude/add-mysql-trace-m434f
Open

Add MySQL trace functionality#2
epli2 wants to merge 2 commits intomainfrom
claude/add-mysql-trace-m434f

Conversation

@epli2
Copy link
Owner

@epli2 epli2 commented Mar 2, 2026

claude added 2 commits March 2, 2026 01:07
Adds end-to-end MySQL query observability without any application
instrumentation, using the existing LD_PRELOAD agent.

Changes:
- phantom-core: new `mysql` module with `MysqlTrace`, `MysqlResponseKind`
  (Ok/ResultSet/Err), and `MysqlStore` trait
- phantom-storage: `FjallMysqlStore` — Fjall-backed `MysqlStore` with two
  partitions (by span_id and by timestamp) for ordered queries
- phantom-agent: `connect()` hook detects MySQL connections by port
  (default 3306, overridable via `PHANTOM_MYSQL_PORT`); per-FD state machine
  (`MysqlConnState`) handles handshake, COM_QUERY, and server response
  parsing (OK / ERR / ResultSet); emits `MysqlTraceMsg` JSON over the
  existing Unix datagram socket with `msg_type = "mysql"`
- phantom-capture: `dispatch_agent_message()` peeks at `msg_type` to route
  HTTP vs MySQL; `start_mysql_aware()` returns both channels; existing
  `CaptureBackend::start()` preserved for backward compatibility
- phantom-tui: new MySQL tab (key `2`); `App` tracks MySQL traces and
  selected index; UI renders list with Time/Query/Result/Duration columns
  and a detail pane; status bar shows `HTTP: N | MySQL: N`
- src/main.rs: opens `FjallMysqlStore`; proxy backend uses a dummy MySQL
  channel; ldpreload backend uses `start_mysql_aware()`; JSONL mode emits
  MySQL traces as `{"type":"mysql", ...}` objects

https://claude.ai/code/session_015N7iRe1Pkx41rHgvgKQaTC
Records the design decisions, implementation order, and test strategy
that guided the MySQL trace feature addition.

https://claude.ai/code/session_015N7iRe1Pkx41rHgvgKQaTC
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.

2 participants