Skip to content

Commit f1124e3

Browse files
committed
Merge branch '4.x'
2 parents 5d3f48b + 1f47307 commit f1124e3

8 files changed

+57
-58
lines changed

.github/ISSUE_TEMPLATE/1_Bug_report.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Bug Report
2-
description: "Report a general library issue."
2+
description: "Report something that's broken."
33
body:
44
- type: markdown
55
attributes:
6-
value: "Before submitting your report, [please ensure your Laravel version is still supported](https://laravel.com/docs/releases#support-policy)."
6+
value: "Please read [our full contribution guide](https://laravel.com/docs/contributions#bug-reports) before submitting bug reports. If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem."
77
- type: input
88
attributes:
99
label: Telescope Version
@@ -14,7 +14,7 @@ body:
1414
- type: input
1515
attributes:
1616
label: Laravel Version
17-
description: Provide the Laravel version that you are using.
17+
description: Provide the Laravel version that you are using. [Please ensure it is still supported.](https://laravel.com/docs/releases#support-policy)
1818
placeholder: 10.4.1
1919
validations:
2020
required: true

.github/workflows/static-analysis.yml

+1-27
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,4 @@ permissions:
1212

1313
jobs:
1414
tests:
15-
runs-on: ubuntu-22.04
16-
17-
strategy:
18-
fail-fast: true
19-
20-
name: Static Analysis
21-
22-
steps:
23-
- name: Checkout code
24-
uses: actions/checkout@v3
25-
26-
- name: Setup PHP
27-
uses: shivammathur/setup-php@v2
28-
with:
29-
php-version: 8.2
30-
tools: composer:v2
31-
coverage: none
32-
33-
- name: Install dependencies
34-
uses: nick-fields/retry@v2
35-
with:
36-
timeout_minutes: 5
37-
max_attempts: 5
38-
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
39-
40-
- name: Execute type checking
41-
run: vendor/bin/phpstan
15+
uses: laravel/.github/.github/workflows/static-analysis.yml@main

CHANGELOG.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/laravel/telescope/compare/v4.17.2...master)
3+
## [Unreleased](https://github.com/laravel/telescope/compare/v4.17.6...master)
4+
5+
## [v4.17.6](https://github.com/laravel/telescope/compare/v4.17.5...v4.17.6) - 2024-02-08
6+
7+
* [4.x] Add `use` to closure to pass in environment condition by [@LaurenceRawlings](https://github.com/LaurenceRawlings) in https://github.com/laravel/telescope/pull/1434
8+
9+
## [v4.17.5](https://github.com/laravel/telescope/compare/v4.17.4...v4.17.5) - 2024-01-30
10+
11+
* [4.x] Ignore duplicate tags by [@driesvints](https://github.com/driesvints) in https://github.com/laravel/telescope/pull/1431
12+
13+
## [v4.17.4](https://github.com/laravel/telescope/compare/v4.17.3...v4.17.4) - 2024-01-22
14+
15+
* [4.x] Add primary keys to database tables by [@driesvints](https://github.com/driesvints) in https://github.com/laravel/telescope/pull/1425
16+
17+
## [v4.17.3](https://github.com/laravel/telescope/compare/v4.17.2...v4.17.3) - 2023-12-11
18+
19+
* fix: clear all entries using chunks by [@skrskr](https://github.com/skrskr) in https://github.com/laravel/telescope/pull/1415
20+
* Ignore pulse and livewire by [@tomswinkels](https://github.com/tomswinkels) in https://github.com/laravel/telescope/pull/1418
421

522
## [v4.17.2](https://github.com/laravel/telescope/compare/v4.17.1...v4.17.2) - 2023-11-01
623

database/migrations/2018_08_08_100000_create_telescope_entries_table.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function up(): void
4242
$table->uuid('entry_uuid');
4343
$table->string('tag');
4444

45-
$table->index(['entry_uuid', 'tag']);
45+
$table->primary(['entry_uuid', 'tag']);
4646
$table->index('tag');
4747

4848
$table->foreign('entry_uuid')
@@ -52,7 +52,7 @@ public function up(): void
5252
});
5353

5454
$schema->create('telescope_monitoring', function (Blueprint $table) {
55-
$table->string('tag');
55+
$table->string('tag')->primary();
5656
});
5757
}
5858

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Console/ClearCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ClearCommand extends Command
1919
*
2020
* @var string
2121
*/
22-
protected $description = 'Clear all entries from Telescope';
22+
protected $description = 'Delete all Telescope data from storage';
2323

2424
/**
2525
* Execute the console command.

src/Storage/DatabaseEntriesRepository.php

+25-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Telescope\Storage;
44

55
use DateTimeInterface;
6+
use Illuminate\Database\UniqueConstraintViolationException;
67
use Illuminate\Support\Collection;
78
use Illuminate\Support\Facades\DB;
89
use Laravel\Telescope\Contracts\ClearableRepository;
@@ -189,14 +190,18 @@ protected function storeExceptions(Collection $exceptions)
189190
protected function storeTags(Collection $results)
190191
{
191192
$results->chunk($this->chunkSize)->each(function ($chunked) {
192-
$this->table('telescope_entries_tags')->insert($chunked->flatMap(function ($tags, $uuid) {
193-
return collect($tags)->map(function ($tag) use ($uuid) {
194-
return [
195-
'entry_uuid' => $uuid,
196-
'tag' => $tag,
197-
];
198-
});
199-
})->all());
193+
try {
194+
$this->table('telescope_entries_tags')->insert($chunked->flatMap(function ($tags, $uuid) {
195+
return collect($tags)->map(function ($tag) use ($uuid) {
196+
return [
197+
'entry_uuid' => $uuid,
198+
'tag' => $tag,
199+
];
200+
});
201+
})->all());
202+
} catch (UniqueConstraintViolationException $e) {
203+
// Ignore tags that already exist...
204+
}
200205
});
201206
}
202207

@@ -246,14 +251,18 @@ public function update(Collection $updates)
246251
protected function updateTags($entry)
247252
{
248253
if (! empty($entry->tagsChanges['added'])) {
249-
$this->table('telescope_entries_tags')->insert(
250-
collect($entry->tagsChanges['added'])->map(function ($tag) use ($entry) {
251-
return [
252-
'entry_uuid' => $entry->uuid,
253-
'tag' => $tag,
254-
];
255-
})->toArray()
256-
);
254+
try {
255+
$this->table('telescope_entries_tags')->insert(
256+
collect($entry->tagsChanges['added'])->map(function ($tag) use ($entry) {
257+
return [
258+
'entry_uuid' => $entry->uuid,
259+
'tag' => $tag,
260+
];
261+
})->toArray()
262+
);
263+
} catch (UniqueConstraintViolationException $e) {
264+
// Ignore tags that already exist...
265+
}
257266
}
258267

259268
collect($entry->tagsChanges['removed'])->each(function ($tag) use ($entry) {

stubs/TelescopeServiceProvider.stub

+4-5
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
1818

1919
$this->hideSensitiveRequestDetails();
2020

21-
Telescope::filter(function (IncomingEntry $entry) {
22-
if ($this->app->environment('local')) {
23-
return true;
24-
}
21+
$isLocal = $this->app->environment('local');
2522

26-
return $entry->isReportableException() ||
23+
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
24+
return $isLocal ||
25+
$entry->isReportableException() ||
2726
$entry->isFailedRequest() ||
2827
$entry->isFailedJob() ||
2928
$entry->isScheduledTask() ||

0 commit comments

Comments
 (0)