Skip to content

Conversation

@huangdijia
Copy link
Contributor

@huangdijia huangdijia commented Dec 18, 2025

Summary

  • Remove duplicate variable assignments in SingletonAspect::process()
  • Add proper singleton instance reset logic using Closure::bind
  • Support both 'instance' and 'instances' property patterns
  • Ensure clean singleton behavior when context already exists

Test plan

  • Verify singleton behavior works correctly with Sentry integration
  • Test that duplicate code is removed and functionality remains intact
  • Check that both 'instance' and 'instances' property patterns are handled
  • Run test suite: composer test:unit --group=sentry

Summary by CodeRabbit

  • Bug 修复

    • 在继续执行前按需重置单例状态,避免旧实例残留导致的不一致或意外行为。
  • 优化

    • 在有参数时更稳健地扩展缓存键以区分实例。
    • 多处度量采集由异步延后改为同步刷新,确保采集周期内即时上报指标,降低延迟和时序不确定性。
    • 统一协程延后执行调用方式,提升一致性与可靠性。
  • 清理

    • 删除无用注释性死代码,减少维护负担。

✏️ Tip: You can customize this high-level summary in your review settings.

…et in SingletonAspect

- Remove duplicate variable assignments in SingletonAspect::process()
- Add proper singleton instance reset logic using Closure::bind
- Support both 'instance' and 'instances' property patterns
- Ensure clean singleton behavior when context already exists
Copilot AI review requested due to automatic review settings December 18, 2025 11:07
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

引入 Closure,在单例切面中重命名局部变量为 $className/$arguments 并在 Context 缓存回调内绑定闭包以在调用原流程前重置单例状态;多个 metrics 监听器将原先的 defer 异步 flush 改为在回调内立即调用 metrics()->flush();删除一段注释死代码。

Changes

Cohort / File(s) 变更摘要
单例切面状态重置逻辑
src/sentry/src/Aspect/SingletonAspect.php
引入 Closure;使用 $className / $arguments;基于 isset($arguments[0]) 扩展缓存键;在 Context::getOrSet() 的回调中绑定闭包到目标类上下文,调用前将单例静态属性($instance$instances[$arg])置 null,然后继续 proceed()
指标监听器:同步刷新替代延迟刷新
src/sentry/src/Metrics/Listener/OnBeforeHandle.php, src/sentry/src/Metrics/Listener/OnCoroutineServerStart.php, src/sentry/src/Metrics/Listener/OnMetricFactoryReady.php, src/sentry/src/Metrics/Listener/OnWorkerStart.php, src/sentry/src/Metrics/Listener/PoolWatcher.php, src/sentry/src/Metrics/Listener/QueueWatcher.php, src/sentry/src/Metrics/Aspect/CounterAspect.php
移除 Hyperf\Coroutine\defer 导入与 defer(...) 异步 flush,改为在定时/回调逻辑末尾直接调用 metrics()->flush();保持指标计算与对外签名不变。
Coroutine defer 命名空间调整
src/sentry/src/Metrics/Aspect/HistogramAspect.php, src/sentry/src/Metrics/Listener/RequestWatcher.php, src/sentry/src/Tracing/Aspect/CoroutineAspect.php, src/sentry/src/Tracing/Listener/EventHandleListener.php, src/sentry/src/Tracing/Tracer.php
将全局或原来的 defer/Coroutine 调用替换为使用别名 Couse Hyperf\Engine\Coroutine as Co),并将相应调用改为 Co::defer() / Co::id()
移除注释死代码
src/sentry/src/Metrics/Traits/MetricSetter.php
删除注释掉的 spawnDefaultMetrics 代码块,仅清理注释代码,无功能变化。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 分钟

  • 重点审查 src/sentry/src/Aspect/SingletonAspect.php 中通过 bindTo 访问/修改静态属性的边界与可行性(私有/受保护静态属性、类可见性)。
  • 验证对 $instance$instances 存在性检查在不同实现下的健壮性和异常情况处理。
  • 审查将缓存键扩展为包含第一个参数后并发/命名冲突的风险。
  • 评估将 metrics flush 从 defer 改为同步在高频 timer 或事件循环中的阻塞与性能影响。

Possibly related PRs

Suggested reviewers

  • xuanyanwow
  • zds-s

兔子的诗

🐰 我是小兔,跳进代码里,
闭包一绑旧实例归零去,
第一个参作为键轻轻记,
flush 立刻,不再等候虚,
proceed 后我啃胡萝卜吃。

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:移除SingletonAspect中的重复代码并改进单例实例重置逻辑,与PR目标和文件变更内容高度一致。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/sentry-singleton-aspect-duplicate-code

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc8869 and a8f7c68.

📒 Files selected for processing (5)
  • src/sentry/src/Metrics/Aspect/HistogramAspect.php (2 hunks)
  • src/sentry/src/Metrics/Listener/RequestWatcher.php (2 hunks)
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php (1 hunks)
  • src/sentry/src/Tracing/Listener/EventHandleListener.php (6 hunks)
  • src/sentry/src/Tracing/Tracer.php (3 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: All PHP files must include declare(strict_types=1) at the top
Use PSR-12 coding standards for PHP code formatting
Use 4-space indentation with short array syntax in PHP code
Use .php-cs-fixer.php configuration for PHP code formatting

All PHP files must include a strict_types declaration at the top

**/*.php: Follow project PHP coding standard enforced by php-cs-fixer with PSR-12 style, 4-space indentation, and short array syntax
Maintain type coverage by updating or adding tests when public APIs change; ensure composer test:types stays green before pushing

Files:

  • src/sentry/src/Metrics/Listener/RequestWatcher.php
  • src/sentry/src/Tracing/Listener/EventHandleListener.php
  • src/sentry/src/Metrics/Aspect/HistogramAspect.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
  • src/sentry/src/Tracing/Tracer.php
src/**/src/**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use namespace pattern FriendsOfHyperf\{ComponentName} for all component classes

Files:

  • src/sentry/src/Metrics/Listener/RequestWatcher.php
  • src/sentry/src/Tracing/Listener/EventHandleListener.php
  • src/sentry/src/Metrics/Aspect/HistogramAspect.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
  • src/sentry/src/Tracing/Tracer.php
src/*/src/**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

src/*/src/**/*.php: Namespace convention for components must follow FriendsOfHyperf{ComponentName}
All code must be coroutine-safe and avoid global state without proper context management, blocking I/O operations, and non-coroutine-safe third-party libraries without wrappers
Use Hyperf's Context API for request-scoped data instead of global state
Follows PSR-12 coding standards and use PHP-CS-Fixer for automatic formatting
Use PHPStan at maximum level for static analysis
Ensure component namespace doesn't conflict with existing Hyperf components or other packages in the ecosystem
Integrate deeply with Hyperf's Dependency Injection container for service registration
Leverage Hyperf's AOP (Aspect-Oriented Programming) for cross-cutting concerns via aspects defined in ConfigProvider
Use Hyperf's Event System to register listeners for framework events in components
All code must support coroutine-based concurrency using Swoole/Swow compatibility

Files:

  • src/sentry/src/Metrics/Listener/RequestWatcher.php
  • src/sentry/src/Tracing/Listener/EventHandleListener.php
  • src/sentry/src/Metrics/Aspect/HistogramAspect.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
  • src/sentry/src/Tracing/Tracer.php
src/**/*.php

📄 CodeRabbit inference engine (AGENTS.md)

Each component lives in its own subdirectory with PSR-4 namespaces matching FriendsOfHyperf\*

Files:

  • src/sentry/src/Metrics/Listener/RequestWatcher.php
  • src/sentry/src/Tracing/Listener/EventHandleListener.php
  • src/sentry/src/Metrics/Aspect/HistogramAspect.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
  • src/sentry/src/Tracing/Tracer.php
🧠 Learnings (5)
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : Use Hyperf's Event System to register listeners for framework events in components

Applied to files:

  • src/sentry/src/Metrics/Listener/RequestWatcher.php
  • src/sentry/src/Tracing/Listener/EventHandleListener.php
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : All code must be coroutine-safe and avoid global state without proper context management, blocking I/O operations, and non-coroutine-safe third-party libraries without wrappers

Applied to files:

  • src/sentry/src/Tracing/Listener/EventHandleListener.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : Leverage Hyperf's AOP (Aspect-Oriented Programming) for cross-cutting concerns via aspects defined in ConfigProvider

Applied to files:

  • src/sentry/src/Metrics/Aspect/HistogramAspect.php
  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : Use Hyperf's Context API for request-scoped data instead of global state

Applied to files:

  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
  • src/sentry/src/Tracing/Tracer.php
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : All code must support coroutine-based concurrency using Swoole/Swow compatibility

Applied to files:

  • src/sentry/src/Tracing/Aspect/CoroutineAspect.php
🧬 Code graph analysis (1)
src/sentry/src/Metrics/Aspect/HistogramAspect.php (1)
src/sentry/src/Metrics/Timer.php (1)
  • end (45-61)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: Test on PHP 8.2 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.3 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.1 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.1 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.2 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.3 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.3 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.1 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.2 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.2 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.2 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.1 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.1 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.1 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.2 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.3 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.3 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.3 with Swoole 6.1.3
  • GitHub Check: Seer Code Review
🔇 Additional comments (13)
src/sentry/src/Metrics/Listener/RequestWatcher.php (1)

16-16: 重构正确,使用别名简化代码。

Hyperf\Engine\Coroutine 导入为 Co 别名并更新 defer 调用是一个清晰的重构。这种改动保持了功能的完全一致性,同时提高了代码的简洁性。

Also applies to: 52-52

src/sentry/src/Metrics/Aspect/HistogramAspect.php (2)

56-58: 代码实现正确。

使用 Co::defer 延迟执行 $timer->end(true) 确保计时器在方法执行完成后结束并刷新指标数据。结合 tap() 辅助函数的使用,既保证了返回值的正确性,又确保了指标的及时上报。

根据 Timer::end() 的实现,传入 true 将调用 metrics()->flush() 立即刷新指标数据,这对于及时上报性能数据是合理的。


19-19: 使用显式协程类替代全局函数。

将导入从 Hyperf\Coroutine\defer 更改为 Hyperf\Engine\Coroutine as Co 提高了代码的明确性和可维护性。此模式已在 Sentry 组件内保持一致,包括 Tracer、EventHandleListener、RequestWatcher 等多个文件中的相同使用方式。

src/sentry/src/Tracing/Tracer.php (3)

14-14: 引入 Co 别名提升代码一致性。

Hyperf\Engine\Coroutine 引入为 Co 别名是一个良好的实践,使协程相关调用更加简洁统一。


79-79: trace 方法中的协程 ID 获取方式已统一。

startTransaction 方法保持一致,使用 Co::id() 获取协程 ID 是正确的。


37-39: 协程 API 迁移已确认正确并保持一致。

使用 Co::defer()Co::id() 替代 Hyperf\Coroutine\defer()Coroutine::id() 的改动符合项目规范。整个 sentry 组件中已完整迁移至 Hyperf\Engine\Coroutine (别名为 Co),其行为与前一代 API 完全等价:Co::defer() 确保作用域在协程退出时正确弹出,Co::id() 正确捕获协程上下文标识。

src/sentry/src/Tracing/Aspect/CoroutineAspect.php (1)

85-88: 协程延迟回调迁移正确。

使用 Co::defer 确保事务在协程完成时正确结束并刷新事件,与项目中其他文件的迁移模式保持一致。

src/sentry/src/Tracing/Listener/EventHandleListener.php (6)

32-32: 统一协程 API 导入。

添加 Co 别名导入以支持后续的 Co::defer 调用,与其他文件保持一致。


331-343: 请求处理的协程延迟清理逻辑正确。

handleRequestReceived 中使用 Co::defer 确保在协程结束时正确清理 span 和 transaction,并刷新事件。这是请求生命周期管理的关键路径。


534-543: 定时任务的事务清理逻辑已正确迁移。

handleCrontabTaskStarting 中的 Co::defer 确保定时任务执行完成后事务被正确结束并刷新事件。


603-612: AMQP 消息处理的协程清理已统一。

AMQP 消息处理完成后的事务清理逻辑已正确迁移到 Co::defer


671-680: Kafka 消息处理的协程清理已统一。

Kafka 消息处理的事务清理逻辑与 AMQP 保持一致,正确使用 Co::defer


721-730: 异步队列任务的协程清理已统一。

异步队列任务处理的事务清理逻辑已完成迁移,与其他事件处理器保持一致的模式。整个文件中所有的延迟清理逻辑都已统一使用 Co::defer,增强了代码的一致性。

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 PHPStan (2.1.33)

At least one path must be specified to analyse.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2348790 and ad491c0.

📒 Files selected for processing (1)
  • src/sentry/src/Aspect/SingletonAspect.php (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.php: All PHP files must include declare(strict_types=1) at the top
Use PSR-12 coding standards for PHP code formatting
Use 4-space indentation with short array syntax in PHP code
Use .php-cs-fixer.php configuration for PHP code formatting

All PHP files must include a strict_types declaration at the top

**/*.php: Follow project PHP coding standard enforced by php-cs-fixer with PSR-12 style, 4-space indentation, and short array syntax
Maintain type coverage by updating or adding tests when public APIs change; ensure composer test:types stays green before pushing

Files:

  • src/sentry/src/Aspect/SingletonAspect.php
src/**/src/**/*.php

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use namespace pattern FriendsOfHyperf\{ComponentName} for all component classes

Files:

  • src/sentry/src/Aspect/SingletonAspect.php
src/*/src/**/*.php

📄 CodeRabbit inference engine (CLAUDE.md)

src/*/src/**/*.php: Namespace convention for components must follow FriendsOfHyperf{ComponentName}
All code must be coroutine-safe and avoid global state without proper context management, blocking I/O operations, and non-coroutine-safe third-party libraries without wrappers
Use Hyperf's Context API for request-scoped data instead of global state
Follows PSR-12 coding standards and use PHP-CS-Fixer for automatic formatting
Use PHPStan at maximum level for static analysis
Ensure component namespace doesn't conflict with existing Hyperf components or other packages in the ecosystem
Integrate deeply with Hyperf's Dependency Injection container for service registration
Leverage Hyperf's AOP (Aspect-Oriented Programming) for cross-cutting concerns via aspects defined in ConfigProvider
Use Hyperf's Event System to register listeners for framework events in components
All code must support coroutine-based concurrency using Swoole/Swow compatibility

Files:

  • src/sentry/src/Aspect/SingletonAspect.php
src/**/*.php

📄 CodeRabbit inference engine (AGENTS.md)

Each component lives in its own subdirectory with PSR-4 namespaces matching FriendsOfHyperf\*

Files:

  • src/sentry/src/Aspect/SingletonAspect.php
🧠 Learnings (1)
📚 Learning: 2025-12-12T05:33:43.947Z
Learnt from: CR
Repo: friendsofhyperf/components PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-12T05:33:43.947Z
Learning: Applies to src/*/src/**/*.php : Leverage Hyperf's AOP (Aspect-Oriented Programming) for cross-cutting concerns via aspects defined in ConfigProvider

Applied to files:

  • src/sentry/src/Aspect/SingletonAspect.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Test on PHP 8.2 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.3 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.1 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.2 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.3 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.1 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.2 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.3 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.1 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.3 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.1 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.3 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.2 with Swoole 6.0.2
  • GitHub Check: Test on PHP 8.1 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.1 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.2 with Swoole 5.1.8
  • GitHub Check: Test on PHP 8.3 with Swoole 6.1.3
  • GitHub Check: Test on PHP 8.2 with Swoole 6.1.3
  • GitHub Check: Agent
  • GitHub Check: Seer Code Review
🔇 Additional comments (1)
src/sentry/src/Aspect/SingletonAspect.php (1)

14-14: LGTM!

正确添加了 Closure 导入以支持后续的 Closure::bind 使用。

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to improve the SingletonAspect by removing duplicate code and adding singleton instance reset logic to ensure proper coroutine-safe singleton behavior. However, the implementation contains several critical bugs that prevent it from working as intended.

Key Changes

  • Adds Closure import and singleton reset logic using Closure::bind
  • Attempts to remove duplicate variable assignments (but introduces new duplicates instead)
  • Adds support for resetting both 'instance' and 'instances' property patterns

Closure::bind(function () use ($className, $arguments) {
match (true) {
property_exists($className, 'instance') => $className::$instance = null,
property_exists($className, 'instances') => $className::$instances[$arguments[0]] = null,
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line attempts to set $className::$instances[$arguments[0]] to null, but it doesn't verify that $arguments[0] exists. If the getInstance() method is called without arguments but the class has an 'instances' property, this will cause an "Undefined array key 0" error. Add a check to ensure $arguments[0] exists before accessing it.

Suggested change
property_exists($className, 'instances') => $className::$instances[$arguments[0]] = null,
property_exists($className, 'instances') && array_key_exists(0, $arguments) => $className::$instances[$arguments[0]] = null,

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@huangdijia huangdijia merged commit ad4f1fc into main Dec 19, 2025
23 checks passed
@huangdijia huangdijia deleted the fix/sentry-singleton-aspect-duplicate-code branch December 19, 2025 01:02
huangdijia added a commit that referenced this pull request Dec 19, 2025
…et in SingletonAspect (#1048)

* fix(sentry): remove duplicate code and improve singleton instance reset in SingletonAspect

- Remove duplicate variable assignments in SingletonAspect::process()
- Add proper singleton instance reset logic using Closure::bind
- Support both 'instance' and 'instances' property patterns
- Ensure clean singleton behavior when context already exists

* 更新 SingletonAspect.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(sentry): refine singleton instance reset logic in SingletonAspect

* fix(metrics): remove unused spawnDefaultMetrics function in MetricSetter trait

* fix(metrics): 移除冗余的defer调用,直接在事件处理后刷新指标

* fix(metrics): 移除defer调用,直接在事件处理后刷新指标

* fix(coroutine): 替换defer调用为Coroutine::defer以统一协程处理方式

---------

Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants