Repository navigation
feat(profiler): receive the stack samples of phpspy and reli-prof, and collapsed stacks - #396
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #396 +/- ##
==========================================
+ Coverage 82.20% 82.40% +0.20%
==========================================
Files 485 489 +4
Lines 20431 20739 +308
==========================================
+ Hits 16796 17091 +295
- Misses 3635 3648 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
roxblnfk
force-pushed
the
feat/phpspy-traces
branch
8 times, most recently
from
November 26, 2026 13:38
c887130 to
af8ba74
Compare
…d collapsed stacks phpspy and reli-prof sample a running PHP process from outside, with no extension or code change; their text traces went nowhere in Trap but through reli's converters. The sampling rate is in neither trace, so the wall time comes only with the `period` query parameter. Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
roxblnfk
force-pushed
the
feat/phpspy-traces
branch
from
November 26, 2026 14:21
af8ba74 to
bdeae55
Compare
2 of 3 tasks
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.
🔍 What was changed
POST /api/profiler/phpspytakes the text traces of phpspy and reli-prof (itsphpspyandphpspy_with_opcodetemplates);POST /api/profiler/collapsedtakes collapsed stacksframe;frame;frame count. Both take gzip, and the query metadata of the other profile endpoints; collapsed stacks also takeclock.ctcounts the samples a function is on the stack in; withperiod(seconds) the profile gets the wall time too: neither tool writes its sampling rate into the trace.formatof the new profiles isPhpspyandCollapsed.Gziphelper.How it works
-b, 4096 bytes by default: most framework stacks) into chunks closed by# trace_id = <trace>.<chunk>~|!, with other processes' samples in between; in single-line mode (-1) these trailers and all metadata sit on the line of the frames, as every record ends with the frame delimiter. Chunks are put together by trace id; a sample with a lost chunk, or cut off at the end of the trace, is dropped, as phpspy's ownstackcollapse-phpspy.pldoes.<main>is file-scope code and becomesmain(); same-named frames of different files (closures before PHP 8.4, the<main>of included files) are told apart by the file.Checklist
400naming ittests/Stub/phpspygive the same call tree as phpspy's ownstackcollapse-phpspy.plphpspyandphpspy_with_opcodetemplates,--trace-varand--depthintests/Stub/religive the same call tree asstackcollapse-phpspy.plDocumentation
docs/profiles.md(endpoints and a phpspy and reli-prof section),docs/mcp.md,skills/trap/references/profiling.md.Review notes
400.NodeBudgetdoesn't count: the function limit is half the node budget, up to 50 000. Replayed atmemory_limit=512M, repeated 45 000-function bodies are built until about 320 MB is in use, then rejected with400. Below the floor ofNodeBudget(5 000 functions here) many kept profiles still exhaust the memory, as of every format: the event store keeps them by count.-1) is told by the first frame, not per line: in the default mode a metadata record of a peeked value (-D,-e) may end with a tab too.profile_summarytakes itsformatenum from the cases of the profileTypeenum, so its output schema follows new formats.clock, and a.phppath root asmain():trap()::profile()->toServer(..., Format::Collapsed)of Excimer sends both.