Skip to content

Commit

Permalink
CLI-1284: Exclude i/o error reports (#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell authored Mar 20, 2024
1 parent fa4ee3e commit 55271ac
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/Helpers/TelemetryHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
class TelemetryHelper {

public function __construct(
private ClientService $cloudApiClientService,
private CloudDataStore $datastoreCloud,
private Application $application,
private ?string $amplitudeKey = '',
private ?string $bugSnagKey = ''
private readonly ClientService $cloudApiClientService,
private readonly CloudDataStore $datastoreCloud,
private readonly Application $application,
private readonly ?string $amplitudeKey = '',
private readonly ?string $bugSnagKey = ''
) {
}

Expand All @@ -47,13 +47,15 @@ public function initializeBugsnag(): void {
$bugsnag->setAppVersion($this->application->getVersion());
$bugsnag->setProjectRoot(Path::join(__DIR__, '..'));
$bugsnag->registerCallback(function (Report $report): bool {
// Exclude reports from app:from, which bootstraps Drupal.
// We aren't responsible for Drupal application errors.
if (str_starts_with($report->getContext(), 'GET')) {
return FALSE;
}
if (str_starts_with($report->getContext(), 'Allowed memory size')) {
return FALSE;
// Exclude errors that we can't control.
switch (TRUE) {
// Exclude reports from app:from, which bootstraps Drupal.
case str_starts_with($report->getContext(), 'GET'):
// Exclude memory exhaustion errors.
case str_starts_with($report->getContext(), 'Allowed memory size'):
// Exclude i/o errors.
case str_starts_with($report->getContext(), 'fgets'):
return FALSE;
}
// Set user info.
$userId = $this->getUserId();
Expand Down

0 comments on commit 55271ac

Please sign in to comment.