Skip to content

feat(profiler): time each edit request from one table of spans - #558

Merged
akhileshh merged 1 commit into
pcgv3from
pcgv3-edit-speed
Nov 27, 2026
Merged

akhileshh merged 1 commit into
pcgv3from
pcgv3-edit-speed

Conversation

@akhileshh

Copy link
Copy Markdown
Contributor

Summary

  • Time each edit request end to end, from the Flask hooks to the graph's writes, with no span added to the edit code: one table in profiler/spans.py names the functions to wrap.
  • Store one timeline per edit under graphene_diagnostics/<graph_id>/timing/, a sibling of the mesh dir, once the response has been sent.
  • Time a split's supervoxel split as a phase: its plan, both chunk locks, the split and the segmentation write. No row reaches inside the splitter package.
  • Move error dumps into the same store, under errors/; dumps already in graphene_errors/ stay where they are.
  • Off unless PCG_PROFILER_ENABLED=1. Memory is tracked as RSS only; tracemalloc never runs in a request.

Cost

  • 0.13 µs per wrapped call outside an edit, 1.0 µs per timed span, 34 µs per coarse span for its two RSS reads.

Test plan

  • pytest pychunkedgraph/tests/utils pychunkedgraph/tests/profiler: 55 passed, also on pcgv3's tip and on both open pcgv3 pull requests with this change applied
  • whole suite: 1276 passed
  • one edit on a server with PCG_PROFILER_ENABLED=1 leaves a file under timing/

🤖 Generated with Claude Code

- `profiler/spans.py` names every function to wrap at startup, a split's supervoxel-split phase included, so no span sits in the edit code.
- With `PCG_PROFILER_ENABLED=1`, each edit's timeline is stored after its response under `graphene_diagnostics/<graph_id>/timing/`, beside the mesh dir.
- `err_dump` moves into that store under `errors/`, no longer under `{WATERSHED}/graphene_errors/`.

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.33028% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pychunkedgraph/profiler/main.py 92.55% 6 Missing and 1 partial ⚠️
pychunkedgraph/profiler/spans.py 97.11% 1 Missing and 2 partials ⚠️
pychunkedgraph/profiler/timeline.py 97.67% 1 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##            pcgv3     #558      +/-   ##
==========================================
+ Coverage   67.51%   69.18%   +1.67%     
==========================================
  Files          89       92       +3     
  Lines        8643     8947     +304     
  Branches     1149     1183      +34     
==========================================
+ Hits         5835     6190     +355     
+ Misses       2619     2560      -59     
- Partials      189      197       +8     
Files with missing lines Coverage Δ
pychunkedgraph/graph/err_dump.py 70.45% <100.00%> (+35.45%) ⬆️
pychunkedgraph/utils/diagnostics.py 100.00% <100.00%> (ø)
pychunkedgraph/profiler/timeline.py 97.67% <97.67%> (ø)
pychunkedgraph/profiler/spans.py 97.11% <97.11%> (ø)
pychunkedgraph/profiler/main.py 91.26% <92.55%> (+9.44%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akhileshh
akhileshh merged commit 37c1aee into pcgv3 Nov 27, 2026
3 checks passed
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