-
-
Notifications
You must be signed in to change notification settings - Fork 470
feat(scope): update aggregator flush to use a client #2125
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
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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
|
|
||
| use Sentry\Attributes\Attribute; | ||
| use Sentry\Client; | ||
| use Sentry\ClientInterface; | ||
| use Sentry\Event; | ||
| use Sentry\EventId; | ||
| use Sentry\SentrySdk; | ||
|
|
@@ -159,20 +160,22 @@ public function add( | |
| $logs->push($log); | ||
|
|
||
| if ($logFlushThreshold !== null && \count($logs) >= $logFlushThreshold) { | ||
| $this->flush($hub); | ||
| $this->flush($client); | ||
| } | ||
| } | ||
|
|
||
| public function flush(?HubInterface $hub = null): ?EventId | ||
| public function flush(?ClientInterface $client = null): ?EventId | ||
| { | ||
| if ($this->logs === null || $this->logs->isEmpty()) { | ||
| $logs = $this->logs; | ||
|
|
||
| if ($logs === null || $logs->isEmpty()) { | ||
| return null; | ||
| } | ||
|
|
||
| $hub = $hub ?? SentrySdk::getCurrentHub(); | ||
| $event = Event::createLogs()->setLogs($this->logs->drain()); | ||
| $client = $client ?? SentrySdk::getCurrentHub()->getClient(); | ||
| $event = Event::createLogs()->setLogs($logs->drain()); | ||
|
|
||
| return $hub->captureEvent($event); | ||
| return $client->captureEvent($event); | ||
|
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. Bug: The direct call to Suggested FixInstead of passing the Prompt for AI AgentAlso affects:
Did we get this right? 👍 / 👎 to inform future reviews. |
||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
Flush skips hub scope
Medium Severity
Aggregator
flushnow sends batched logs and metrics viaClient::captureEventwithout aScope. PreviouslyHub::captureEventalways passed the hub scope, so scope event processors and scope enrichment no longer run on these flush events.Additional Locations (1)
src/Metrics/MetricsAggregator.php#L139-L143Reviewed by Cursor Bugbot for commit 8d1c6f0. Configure here.