Add streaming to `profiling.sampling`
未关闭
还没有人认领这个 Issue。
stdlib
topic-profiling
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
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 would be ideal for long-running headless profiling.
This one is less defined than #145411, so there are more open questions:
- Should it stream raw or agreggate data? What should be the window?
- 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.
- What should be the transport layers for streaming?
- What should be the types of messages?
- What should be the configuration flags?
- How the backpressure should be handled? Should it drop the oldest? All the oldest?
My hunch is:
- support both raw and aggregate and assume that aggregate is just a different message type.
- start with something simple as JSONL
- 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
- as for backpressure, I would just drop the oldest by default, but only the
raw,aggandheartbeatmessages.
For starters:
--stream unix:/tmp/tachyon-stream.sockor--stream file:/tmp/tachyon-stream.sock(later:--stream tcp:127.0.0.1:1234)--stream-types meta|str_def|frame_def|raw|agg:5s|loss|heartbeat|end|error(comma separated; note theagg:5shere; we it could be extended toheartbeat:1setc. in the future)--stream-format jsonl
Then, in the next phases we could think of --stream-drop-policy etc.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先阅读 profiling.sampling 的实现以及 issue #145411 中的相关讨论。在缩小设计范围之前,审查提议的流类型、JSONL 格式、传输方式和 backpressure 相关问题。确定了经过一致同意的流式处理范围以及支持长期运行 headless profiling 的配置后,即可完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- performance
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100