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

Initialize the SDK using php auto-prepend-file #1712

Closed
azenned opened this issue Mar 7, 2024 · 1 comment
Closed

Initialize the SDK using php auto-prepend-file #1712

azenned opened this issue Mar 7, 2024 · 1 comment

Comments

@azenned
Copy link

azenned commented Mar 7, 2024

Problem Statement

As the SDK need to be initialised as early as possible in the application ( \Sentry\init(['dsn' => 'PUBLIC_DSN' ]); )
And the SDK require composer to be loaded , we are missing all composer loader profiling data.

Solution Brainstorm

Can we use php auto-prepend-file directive to load minimalist php script file and init the SDK ?
https://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file

@stayallive
Copy link
Collaborator

we are missing all composer loader profiling data.

If it's just for performance tracing reasons there is another solution. Add a define('APP_START', microtime(true)); to your entry file as the first line, this way you can just after loading composer set another timestamp all the way up until you are loading Sentry.

You can then backdate the spans accordingly. We do this for example in our Laravel SDK.

Unless I'm missing something I think the minimal auto-prepend file would look just like that (defining a timestamp) and nothing more really.

@azenned azenned changed the title Initialize the SDK using pgauto-prepend-file Initialize the SDK using php auto-prepend-file Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants