python / python/cpython

API for outputting different formats from CPython sampling profiler

Offen
#138,383 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

performance stdlib topic-profiling type-feature
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der Lektüre von Lib/profiling/sampling/stack_collector.py und der bestehenden Verarbeitung von pstats und collapsed-format, auf die im Issue verwiesen wird. Lesen Sie die verlinkte Discourse-Diskussion, bevor Sie eine Schnittstelle für Collector von Drittanbietern vorschlagen; als abgeschlossen würde eine vereinbarte API, klar definierte Grenzen der unterstützten Formate sowie ein Plan für die Build-, Test- und Distributionsbeschränkungen von CPython voraussetzen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
performance
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.