Skip to content

[NFR]: Add a direct push API to collectors #44

Closed

Description

@niden

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 [NFR]: Move MVC event names from collectors to an MVC bridge #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

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. added theissue type on Nov 3, 2026
  3. moved this from Backlog to Active Sprint in Phalcon v5on Nov 3, 2026
  4. niden commented on Nov 3, 2026

    @niden
    SponsorMemberAuthor

    Resolved in #52

  5. moved this from Active Sprint to Implemented in Phalcon v5on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

  • Status
    Implemented

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions