Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://claude.ai/code/session_015N7iRe1Pkx41rHgvgKQaTC