API for outputting different formats from CPython sampling profiler
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Proposal:
CPython 3.15 has statistical sampling profiler which currently only supports outputting
- pstats https://docs.python.org/3.15/library/profile.html#pstats.Stats
- collapsed format for flamegraphs https://github.com/python/cpython/blob/8d5c3341c538cd1a4192ca8a1536b2eed4b98c69/Lib/profiling/sampling/stack_collector.py#L24
Since it's still an early stage for the sampling profiler, I thought it would be nice to initiate discussion around how to support multiple different formats from the profiler.
- pprof
- OTel
are the formats that could potentially be added, but supporting those from CPython would introduce dependencies that might complicate building/testing and distributing CPython.
I'd like to suggest that CPython has an interface to support 3rd party collectors. What do you think?
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Lib/profiling/sampling/stack_collector.py and the existing pstats and collapsed-format handling referenced in the issue. Review the linked Discourse discussion before proposing an interface for third-party collectors; done would require an agreed API, supported format boundaries, and a plan for CPython build, testing, and distribution constraints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100