[NFR]: Add a direct push API to collectors

已关闭
#44 0 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@niden 已经在做这个了。

开始于 2026年11月3日。

评估

这个 Issue 还没有评估数据。

描述

enhancement
Summary

Most collectors can receive data only through their event listeners. A host that has other data sources, or no events manager, cannot feed them. Add public methods to these collectors. Behavior does not change.

Current state
  • ExceptionsCollector::addThrowable() already exists and does not change.
  • DatabaseCollector, ViewCollector, RouteCollector and CacheCollector write their data only inside subscribe() closures.
Proposed direction

Follow the addThrowable() naming. The existing listeners call the new methods.

  • DatabaseCollector: a start method and a finish method that takes the SQL and the bindings. The collector measures the time.
  • ViewCollector: a start method that takes the path and a finish method. The pending stack stays, so nested partials are timed correctly.
  • CacheCollector: a method that takes the operation and the key.
  • RouteCollector: a method that takes the panel values, or a callable that returns them. The collector calls the callable at collect time. This keeps the MVC read at collect time, because the MVC router is not fully resolved when router:matchedRoute fires. After #15, the collector needs no Phalcon\Mvc import.
Acceptance
  • Each collector gets data through its new method, with no events manager.
  • The existing collector tests pass with the same expected results.
  • Tests pass with full coverage. phpcs and phpstan pass.
Part of

#13

主要语言
PHP
星标
6
派生
3
平均合并
5 小时 50 分钟
30 天内合并 PR
18

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。