[NFR]: Add a direct push API to collectors

Geschlossen
#44 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@niden arbeitet bereits daran.

Seit 03.11.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

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

Vorherrschende Sprache
PHP
Sterne
6
Forks
3
Ø Merge
3 Std. 31 Min.
Gemergte PRs (30 T.)
43

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus phalcon/debugbar

Alle Issues in phalcon/debugbar

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

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