Repository navigation
Conversation
CPU profilers record only the synchronous stack, so in LunaServer most samples root at processTicksAndRejections with no caller. This addon samples the stack with V8's await chain from an interrupt, keeps V8's raw frames and the async context, and leaves formatting for after the request. It uses only the public V8 API, and builds against our headers like pprof. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
Agent notes (Claude Opus 5.5)
V8's CPU profiler drops the await chain, so LunaServer's Datadog profiles can't show which of our code a hot function was running for. This adds
@asana/async-stack-sampler, a small native addon built into the Node packages tarball next to pprof. A timer thread requests an interrupt. On the main thread, the interrupt captures the stack through the publicException::CaptureStackTraceAPI, await chain included, plus the async context, so the caller can match each sample to its request. Stacked on #39 for the Dockerfile changes. LunaServer side: codez#473225.Tradeoffs
start()andstop(), which LunaServer calls per diagnosed request.Asana tasks: https://app.asana.com/1/15793206719/dev/space/1220418525288093/ticket/1220638641742555
CC:
Test Plan
--stress-compactionit took 269 samples, with 2.9 ms of capture time in total.nodejs26pc.