Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual Instrumentation #4

Closed
philkra opened this issue Oct 8, 2019 · 2 comments
Closed

Manual Instrumentation #4

philkra opened this issue Oct 8, 2019 · 2 comments
Assignees
Labels
php PHP codebase
Milestone

Comments

@philkra
Copy link
Contributor

philkra commented Oct 8, 2019

Provide the PHP classes reflecting the APM event specs for users to manually instrument their codebase, leveraging the c-ext as a sender. These events are passed to the c-ext with a method e.g. elasticapm_send_event(string $event) and the c-ext takes care of the sending to the APM server.

@philkra philkra added the php PHP codebase label Oct 8, 2019
@philkra philkra self-assigned this Oct 8, 2019
@SergeyKleyman
Copy link
Contributor

There is a technical challenge when combined with automatic instrumentation using PHP extension. A lot of PHP code (tracer logic, etc.) is going to be shared between PHP part of the extension and PHP library for manual instrumentation. The problem arises when versions of this code are compatible. The extension runs first so it might load some classes of version A and then application might try to use those classes for manual instrumentation causing fatal error such as missing method or property, wrong argument count/types, etc.

We might consider using

  • Composer's custom autoloading feature to check if the extension is present and if its version is compatible with API used by the application for manual instrumentation.
  • Or we can try to detect from the extension if there's our manual instrumentation library in vendor directory and if its version compatible
    • A possible improvement on the approach above is to use code from vendor even by the extension if the version in vendor is "better" (contains more fixes, etc.)

@SergeyKleyman
Copy link
Contributor

Public API is already implemented and documented at https://www.elastic.co/guide/en/apm/agent/php/current/public-api.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
php PHP codebase
Projects
None yet
Development

No branches or pull requests

2 participants