Easier way to add Sentry to libraries and plugins
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reviewing the referenced pay-with-flex.php integration and the SDK's Hub and Frame handling, then inspect how the default integrations obtain their hub and scope. Compare the client-stack and custom-hub ideas against the stated isolation requirements; done should be a documented, supported way for libraries or plugins to report only their own errors without taking over a host application's client.
Written by the indexing model from the issue text.
Description
Problem Statement
We want to be aware of when our customers run into problems with our plugin. The most straightforward way to do that is to add Sentry to our plugin:
https://github.com/JoinFlexHealth/woocommerce/blob/a0a66e8ebad2f8368a7f23ea7cd5a79985a104a3/pay-with-flex.php#L52-L222
However, this is a lot of code and it only actually works for exceptions/errors that are handled. We could register the global Sentry client, but we didn't want to takeover an existing client in the code base. Nor do we want to receive events for things that are outside of our control.
Solution Brainstorm
I had two different ideas here:
- It would be helpful if the Sentry global could accept a "stack" of clients. It looks like this is almost supported because
Hubsupports an array ofFrameinstances, each can have their own client. However, upon further inspection it doesn't look like that would actually work without adding/removing our client from the stack with each function call. I wish the Hub would just loop through all the clients in the stack and report the error to each unique client / DSN. That would also allow our client to be able to filter through all errors. - If you don't want to do that, another thing that would have been super helpful is allowing the default integrations to accept a custom hub/scope rather than the global one. I basically had to copy / re-implement a lot of the default integration code because the only way to use them is with the global instance.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 475
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 43
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-php
-
Improvement PHP
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
getsentry/sentry-php#2243 · 4 comments ·
Maintainers usually reply within 3 days
-
Implement Global AttributesPossibly taken @Litarnus claimed this 2 days ago. OpenPHP
getsentry/sentry-php#2238 · 1 comment · 1 assignee ·
Maintainers usually reply within 3 days
-
Support for Continuous ProfilingPossibly taken @Litarnus claimed this 2 days ago. OpenPHP
getsentry/sentry-php#2237 · 1 comment · 1 assignee ·
Maintainers usually reply within 3 days
-
PHP 8.6 SupportPossibly taken @Litarnus claimed this 5 days ago. OpenPHP
getsentry/sentry-php#2231 · 1 comment · 1 assignee ·
Maintainers usually reply within 3 days
-
Add span streaming supportPossibly taken @Litarnus claimed this 5 days ago. OpenPHP Span First
getsentry/sentry-php#2229 · 1 comment · 1 assignee ·
Maintainers usually reply within 3 days
All issues in getsentry/sentry-php
Similar issues
-
Bug Enhancement Performance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Feature Status: Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
frontend low-priority
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
mplodowski/dynamicpdf-plugin#336 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AdvancedCustomFields/acf#1044 ·
-
Add ZammadPossibly taken @Arslan-TR claimed this today. Openrequest
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
endoflife-date/endoflife.date#11298 · 1 comment ·
Maintainers usually reply within 1 day