Add MySQL trace functionality#2
Closed
epli2 wants to merge 2 commits into
Closed
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
Owner
Author
|
Closing this PR for now based on the project roadmap (ROADMAP.md, §1.2 and §9 / ADR-1). Rationale:
This isn't a rejection of the feature — I've opened #6 to track it as deferred, future work referencing this PR. Closing without prejudice; feel free to reopen or link a fresh branch once P4-4 lands. Generated by Claude Code |
epli2
pushed a commit
that referenced
this pull request
Jul 6, 2026
Analyze current implementation and open PRs (#2, #4), redefine phantom's concept as a local-first API development toolbox (observe / perturb / record-replay / spec-gen), and lay out a 5-phase roadmap (P0-P4) with per-task dependencies, implementation steps, acceptance criteria, and an LLM-agent working protocol. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EgPcomgY5nj8RuU8V1G82Y
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