mirror of
https://github.com/qdrant/qdrant.git
synced 2026-09-21 13:37:46 -05:00
* Add tools/callgraph: interactive call-graph reports via rust-analyzer Generates a self-contained HTML report for one function: pan/zoom graphviz graph of callers and callees, per-node docs and source snippets, exact call sites with context, GitHub/editor links. - rust-analyzer call hierarchy over LSP gives resolved (not textual) edges; trait declarations and impls are bridged via goto-declaration / goto-implementation so dispatch through a trait doesn't dead-end the walk - test code excluded by running rust-analyzer with cfg(test) disabled, plus path filters for tests/, benches/, examples/ targets - no dependencies beyond rust-analyzer and graphviz on PATH Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RgxVoa6hfvgB7r6FVbcGmg * Add screenshot to tools/callgraph README Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RgxVoa6hfvgB7r6FVbcGmg --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
callgraph
Interactive call-graph reports for one function of the Qdrant workspace, viewable in a browser: pan/zoom graph, per-node docs and source snippets, exact call sites, GitHub/editor links.
tools/callgraph/callgraph.py read_bytes_async # by name
tools/callgraph/callgraph.py universal_io::traits::read_bytes_async # :: segments disambiguate
tools/callgraph/callgraph.py lib/common/common/src/universal_io/traits/read.rs:113
Prints a file://…/target/callgraph/<fn>.html link when done. Requires
rust-analyzer and graphviz dot on PATH; no Python dependencies.
How it works
- rust-analyzer's call hierarchy over LSP provides resolved (not textual) caller/callee edges; both directions are collected in one run.
- Trait declarations and their impls are bridged via goto-implementation / goto-declaration, so a walk doesn't dead-end when a call dispatches through a trait (dashed edges in the graph).
- Test code is excluded for real: rust-analyzer runs with
cfg(test)off, andtests/,benches/,examples/targets are filtered by path. - Layout by graphviz at generation time; the report itself is one self-contained HTML file with no external resources.
Options
--depth N— call hops from the root (default 4)--max-nodes N— per-view node cap (default 250)--out PATH— output HTML path
Performance note
Each run cold-starts rust-analyzer, which re-indexes the workspace (~3 min).
If runs become frequent, the upgrade path is a --serve mode that keeps one
rust-analyzer instance alive between reports.
