From aa8281ac0e3fd92c9237d29fb905788bce8defe8 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 15 Aug 2019 11:21:57 +0200 Subject: [PATCH 1/3] Log failed requests --- src/IncomingEntry.php | 11 +++++++++++ stubs/TelescopeServiceProvider.stub | 1 + 2 files changed, 12 insertions(+) diff --git a/src/IncomingEntry.php b/src/IncomingEntry.php index 43bf38233..60c292a00 100644 --- a/src/IncomingEntry.php +++ b/src/IncomingEntry.php @@ -178,6 +178,17 @@ public function isFailedJob() ($this->content['status'] ?? null) === 'failed'; } + /** + * Determine if the incoming entry is a failed request. + * + * @return bool + */ + public function isFailedRequest() + { + return $this->type === EntryType::REQUEST && + ($this->content['response_status'] ?? 200) >= 500; + } + /** * Determine if the incoming entry is a reportable exception. * diff --git a/stubs/TelescopeServiceProvider.stub b/stubs/TelescopeServiceProvider.stub index 6d66c38d3..707c2df2d 100644 --- a/stubs/TelescopeServiceProvider.stub +++ b/stubs/TelescopeServiceProvider.stub @@ -27,6 +27,7 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider return $entry->isReportableException() || $entry->isFailedJob() || + $entry->isFailedRequest() || $entry->isScheduledTask() || $entry->hasMonitoredTag(); }); From 6bb65c3346ad35a65f484931fb36c75e47b3b791 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 15 Aug 2019 11:05:09 -0500 Subject: [PATCH 2/3] Update IncomingEntry.php --- src/IncomingEntry.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/IncomingEntry.php b/src/IncomingEntry.php index 60c292a00..05bd974b5 100644 --- a/src/IncomingEntry.php +++ b/src/IncomingEntry.php @@ -168,25 +168,25 @@ public function hasMonitoredTag() } /** - * Determine if the incoming entry is a failed job. + * Determine if the incoming entry is a failed request. * * @return bool */ - public function isFailedJob() + public function isFailedRequest() { - return $this->type === EntryType::JOB && - ($this->content['status'] ?? null) === 'failed'; + return $this->type === EntryType::REQUEST && + ($this->content['response_status'] ?? 200) >= 500; } - + /** - * Determine if the incoming entry is a failed request. + * Determine if the incoming entry is a failed job. * * @return bool */ - public function isFailedRequest() + public function isFailedJob() { - return $this->type === EntryType::REQUEST && - ($this->content['response_status'] ?? 200) >= 500; + return $this->type === EntryType::JOB && + ($this->content['status'] ?? null) === 'failed'; } /** From 0c583bd9d73d5ed18edadf88954697c9c10e2416 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 15 Aug 2019 11:05:48 -0500 Subject: [PATCH 3/3] Update TelescopeServiceProvider.stub --- stubs/TelescopeServiceProvider.stub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/TelescopeServiceProvider.stub b/stubs/TelescopeServiceProvider.stub index 707c2df2d..b75abbb38 100644 --- a/stubs/TelescopeServiceProvider.stub +++ b/stubs/TelescopeServiceProvider.stub @@ -26,8 +26,8 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider } return $entry->isReportableException() || - $entry->isFailedJob() || $entry->isFailedRequest() || + $entry->isFailedJob() || $entry->isScheduledTask() || $entry->hasMonitoredTag(); });