HarperFast / HarperFast/harper-pro
pprof expansion: on-demand profiling operations API + Studio viewer (umbrella)
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 80
Description
**Umbrella for the pprof expansion Story.** Harper already runs the Datadog pprof time-profiler continuously and records aggregated CPU samples to analytics (see [`analytics/profile.ts`](analytics/profile.ts) in harper-pro). What's missing is operator-facing tooling on top of that.
## Sub-tasks (from the Jira subtasks under CORE-2943)
- [ ] **Operations API to run a profile on demand** (CORE-2945). The profiler runs continuously, so this needs to either increase sampling frequency on the next run, or interrupt the current profile and start a new one. Coordinate with target thread(s) via ITC; collect and return the profile to the caller.
- [ ] **Restart profiler with altered sampling frequency** (CORE-2950). Currently the sampling interval is hardcoded at 50000 µs in `profile.ts:26`. Expose it as a request parameter for on-demand profiles.
- [ ] **Operations API to take a heap profile** (CORE-2949). Separate from the time profiler — uses Node's heap snapshot or pprof's heap profiler.
- [ ] **Auto-select the most-utilized thread for profiling** (CORE-2946). Default behavior when the caller doesn't specify a thread: profile the thread currently doing the most work.
- [ ] **Combine all thread profiles into a single gzip response** (CORE-2947). Multi-profile container (e.g. concatenated pprof or a small zip).
- [ ] **Profile viewer in Studio** (CORE-2948). UI work — belongs in `HarperFast/studio` repo; cross-link when filed.
## Verified state (2026-05-19)
- `analytics/profile.ts` in harper-pro implements continuous time-profile sampling, records `cpu-usage` analytics, includes child-process CPU via `/proc` walk. None of the operator-facing API subtasks above are implemented.
- The continuous sampling is what powers the existing CPU-attribution metrics; it should keep running. The new operations API needs to coexist (interrupt-and-restart or temporarily up-sample).
## Acceptance criteria (for the umbrella)
All 6 sub-tasks above have a concrete answer (implemented, deferred with reason, or split out). When the last sub-issue closes, this umbrella closes.
## Related
- bari noted in [CORE-3021](https://harperdb.atlassian.net/browse/CORE-3021) that profiling improvements landed in 4.7 — those are the continuous-sampling-into-analytics ones, not the on-demand API.
---
Tracked in Jira: [CORE-2943](https://harperdb.atlassian.net/browse/CORE-2943) (Story) with subtasks CORE-2945, 2946, 2947, 2948, 2949, 2950.
🤖 Filed by Claude on behalf of Kris.
Contributor guide
Assessment
This issue has not been assessed yet.