python / python/cpython

API for outputting different formats from CPython sampling profiler

オープン
#138,383 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

performance stdlib topic-profiling type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

Proposal:

CPython 3.15 has statistical sampling profiler which currently only supports outputting

  1. pstats https://docs.python.org/3.15/library/profile.html#pstats.Stats
  2. 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.

  1. pprof
  2. 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:

https://discuss.python.org/t/pre-pep-api-for-outputting-different-formats-from-cpython-sampling-profiler/103490

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず Lib/profiling/sampling/stack_collector.py と、issue で参照されている既存の pstats および collapsed-format の処理を読んでください。サードパーティ製 collector のインターフェースを提案する前に、リンク先の Discourse の議論を確認してください。完了とするには、合意された API、サポートする形式の境界、および CPython のビルド、テスト、配布に関する制約への対応計画が必要です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
performance
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。