Skip to content

Conversation

@ptondereau
Copy link
Member

@ptondereau ptondereau commented Jan 24, 2026

Description

We add Zend Observer API bindings behind the observer feature flag for building profilers, tracers, and instrumentation tools.

The implementation provides a FcallObserver trait with three methods: should_observe to filter which functions to observe (result is cached by PHP), begin called at function entry, and end called at function exit even on exceptions. FcallInfo provides metadata including function name, class name, filename, line number, and whether the function is internal.

The observer uses a factory pattern with Send + Sync requirements for thread safety in both NTS and ZTS PHP builds. Registration happens via ModuleBuilder::fcall_observer during module setup.

@coveralls
Copy link

coveralls commented Jan 24, 2026

Pull Request Test Coverage Report for Build 21322610570

Details

  • 4 of 69 (5.8%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 34.609%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/builders/module.rs 1 7 14.29%
src/zend/observer.rs 3 62 4.84%
Totals Coverage Status
Change from base Build 21296895878: -0.4%
Covered Lines: 1827
Relevant Lines: 5279

💛 - Coveralls

@ptondereau ptondereau marked this pull request as ready for review January 24, 2026 22:27
@ptondereau ptondereau merged commit f4f2f3a into master Jan 25, 2026
65 checks passed
@ptondereau ptondereau deleted the feat/observer-api branch January 25, 2026 15:50
@Xenira Xenira mentioned this pull request Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants