refactor(sentry): optimize event data setting in EventHandleListener#937
Conversation
Move data setting from after-event handlers to before-event handlers to: - Improve tracing performance by setting data earlier - Ensure consistent data availability across all event types - Reduce code duplication and improve maintainability Affects command, crontab, AMQP, Kafka, and async queue tracing
|
Caution Review failedThe pull request is closed. Walkthrough在两个 CoroutineAspect 中移除了在协程上下文传播键列表中的 SentrySdk::class;在 Tracing 的 EventHandleListener 中调整了各类事件(命令、Crontab、AMQP、Kafka、异步队列)的开始与结束时记录的数据与标签策略,增加开始阶段的结构化数据并在结束阶段移除详细数据或仅保留结果性标签。 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Producer as 触发源
participant Listener as EventHandleListener
participant Tracer as Tracing/Transaction
participant Sink as Exporter
rect rgb(242,248,255)
note over Producer,Listener: 事件开始(命令/Crontab/AMQP/Kafka/异步队列)
Producer->>Listener: onStart(event)
Listener->>Tracer: startTransaction/span
Listener->>Tracer: set tags/data(丰富的起始元数据)
end
alt 处理成功
Listener-->>Listener: 处理业务逻辑
Listener->>Tracer: finish准备(清理详细data)
Listener->>Tracer: set result/exit_code 等结果性标签
Tracer-->>Sink: export(span/transaction)
else 处理失败
Listener-->>Tracer: recordException
Listener->>Tracer: finish with error
Tracer-->>Sink: export(error span)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
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.28)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. Comment |
…937) * refactor(sentry): optimize event data setting in EventHandleListener Move data setting from after-event handlers to before-event handlers to: - Improve tracing performance by setting data earlier - Ensure consistent data availability across all event types - Reduce code duplication and improve maintainability Affects command, crontab, AMQP, Kafka, and async queue tracing * 修复:注释掉 SentrySdk 类的导入 --------- Co-authored-by: Deeka Wong <[email protected]>
Summary
This PR optimizes the Sentry event data setting in
EventHandleListenerby moving data configuration from after-event handlers to before-event handlers across multiple event types.Changes Made
BeforeCommandHandleBeforeCrontabDispatchBeforeAmqpConsumeBeforeKafkaConsumeBeforeAsyncQueueHandleBenefits
Affected Components
Test Plan
Summary by CodeRabbit
新功能
重构