Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Easier way to add Sentry to libraries and plugins

Open
#1,840 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
backend

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

Feature PHP
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:

  1. It would be helpful if the Sentry global could accept a "stack" of clients. It looks like this is almost supported because Hub supports an array of Frame instances, 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.
  2. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-php

All issues in getsentry/sentry-php

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.