Title: Add streaming to `profiling.sampling` · Issue #145464 · python/cpython · GitHub
Open Graph Title: Add streaming to `profiling.sampling` · Issue #145464 · python/cpython
X Title: Add streaming to `profiling.sampling` · Issue #145464 · python/cpython
Description: Feature or enhancement Proposal: Right now, profiling.sampling has roughly two modes: live with the TUI, and snapshot-at-the-end (except binary? but see the note below.) There's nothing that streams the data continously as it comes. This...
Open Graph Description: Feature or enhancement Proposal: Right now, profiling.sampling has roughly two modes: live with the TUI, and snapshot-at-the-end (except binary? but see the note below.) There's nothing that stream...
X Description: Feature or enhancement Proposal: Right now, profiling.sampling has roughly two modes: live with the TUI, and snapshot-at-the-end (except binary? but see the note below.) There's nothing that st...
Opengraph URL: https://github.com/python/cpython/issues/145464
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add streaming to `profiling.sampling`","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nRight now, `profiling.sampling` has roughly two modes: live with the TUI, and snapshot-at-the-end (except binary? but see the note below.) There's nothing that streams the data continously as it comes. This would be ideal for long-running headless profiling.\n\nThis one is less defined than #145411, so there are more open questions:\n\n* Should it stream raw or agreggate data? What should be the window?\n* What should be the format? Unfortunately, from what I checked the current binary format is not really well-suited for streaming, as it saves the dictionaries only on finalize.\n* What should be the transport layers for streaming?\n* What should be the types of messages?\n* What should be the configuration flags?\n* How the backpressure should be handled? Should it drop the oldest? All the oldest?\n\nMy hunch is:\n\n- support both raw and aggregate and assume that aggregate is just a different message type.\n- start with something simple as JSONL\n- I have mixed feelings about the transport layer. The stdout sounds great on paper but it's a mixed-use channel right now and there's a question around blocking by slower consumers. Maybe for debugging? Unix socket is good but not perfectly portable\n- as for backpressure, I would just drop the oldest by default, but only the `raw`, `agg` and `heartbeat` messages.\n\nFor starters:\n\n* `--stream unix:/tmp/tachyon-stream.sock` or `--stream file:/tmp/tachyon-stream.sock` (later: `--stream tcp:127.0.0.1:1234`)\n* `--stream-types meta|str_def|frame_def|raw|agg:5s|loss|heartbeat|end|error` (comma separated; note the `agg:5s` here; we it could be extended to `heartbeat:1s` etc. in the future)\n* `--stream-format jsonl`\n\nThen, in the next phases we could think of `--stream-drop-policy` etc.\n\n### Has this already been discussed elsewhere?\n\nNo response given\n\n### Links to previous discussion of this feature:\n\n_No response_","author":{"url":"https://github.com/maurycy","@type":"Person","name":"maurycy"},"datePublished":"2026-03-03T11:25:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/145464/cpython/issues/145464"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:20b4d608-8825-da81-9393-cc422fc9df09 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80AE:208250:336A34:446DBA:6A5140B8 |
| html-safe-nonce | ed42f31509e28d9a7bbe5f35b98e5b23e82b5a1b407b71780af1b1cab0fc29ab |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEFFOjIwODI1MDozMzZBMzQ6NDQ2REJBOjZBNTE0MEI4IiwidmlzaXRvcl9pZCI6IjY5MjMxODQ2MzM3NzAyMjk5NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a91b66c592292ef1c686420462f45c1e4d6053a19ac9f1d74720bd9f9c6d39ce |
| hovercard-subject-tag | issue:4016145553 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/145464/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8b2a54a41632f36aa23d99e0ca893d1beb19fafd4873ba703d1717be25624fff/python/cpython/issues/145464 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8b2a54a41632f36aa23d99e0ca893d1beb19fafd4873ba703d1717be25624fff/python/cpython/issues/145464 |
| og:image:alt | Feature or enhancement Proposal: Right now, profiling.sampling has roughly two modes: live with the TUI, and snapshot-at-the-end (except binary? but see the note below.) There's nothing that stream... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maurycy |
| hostname | github.com |
| expected-hostname | github.com |
| None | e840f405b2718e8f2d55aafa9ff27dbce17e29d0c253011d05ea0fea3c78baff |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e876f00c5723f6080b9d294e4958fd4d506e6faf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width