Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Easier way to add Sentry to libraries and plugins

未关闭
#1,840 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
php
领域
backend

调研方向

首先检查所引用的 pay-with-flex.php 集成以及 SDK 对 Hub 和 Frame 的处理,然后查看默认集成如何获取其 hub 和 scope。将 client-stack 和 custom-hub 的思路与所述的隔离要求进行比较;当存在一种有文档记录且受支持的方式,使库或插件只能报告自身的错误,而不会接管宿主应用程序的 client 时,即可视为完成。

由索引模型根据 Issue 内容生成。

描述

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.
主要语言
PHP
星标
1.9k
派生
475
平均合并
4 天 7 小时
30 天内合并 PR
43

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-php 的其他 Issue

查看 getsentry/sentry-php 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。