-
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: improve cache key handling in CacheAspect #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
28499d9
54b05ed
2fd067d
fc2e529
742de23
4fbfc32
575cd1a
39f1bf7
a834d66
0c50834
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -114,11 +114,14 @@ protected function finishTransaction(AfterExecute $event): void | |||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| $transaction->setStatus($exitCode == SymfonyCommand::SUCCESS ? SpanStatus::ok() : SpanStatus::internalError()); | ||||||||||||||||||||||||||||
| $transaction->setData($data); | ||||||||||||||||||||||||||||
| $transaction->setTags($tags); | ||||||||||||||||||||||||||||
| $transaction | ||||||||||||||||||||||||||||
| ->setOrigin('auto.command') | ||||||||||||||||||||||||||||
| ->setStatus($exitCode == SymfonyCommand::SUCCESS ? SpanStatus::ok() : SpanStatus::internalError()) | ||||||||||||||||||||||||||||
| ->setData($data) | ||||||||||||||||||||||||||||
| ->setTags($tags); | ||||||||||||||||||||||||||||
|
Comment on lines
+117
to
+121
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 最终 setStatus 可能覆盖异常状态 若前面已捕获异常并 setStatus(internalError),但 exitCode 为 SUCCESS,这里的链式 setStatus 会把状态改回 ok,导致误报。建议综合异常与退出码计算最终状态: - $transaction
- ->setOrigin('auto.command')
- ->setStatus($exitCode == SymfonyCommand::SUCCESS ? SpanStatus::ok() : SpanStatus::internalError())
- ->setData($data)
- ->setTags($tags);
+ $finalStatus = (isset($exception) && $exception) || $exitCode !== SymfonyCommand::SUCCESS
+ ? SpanStatus::internalError()
+ : SpanStatus::ok();
+ $transaction
+ ->setOrigin('auto.command')
+ ->setStatus($finalStatus)
+ ->setData($data)
+ ->setTags($tags);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| SentrySdk::getCurrentHub()->setSpan($transaction); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| $transaction->finish(microtime(true)); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
严重:finally 对 $span 的未判空调用可能 fatal
startSpan()可能返回 null;即使在 try 内if (! $span) return $result;,finally 仍会执行,现有代码会在 null 上调用方法。应使用 nullsafe。建议:
🤖 Prompt for AI Agents