Skip to content

Commit c43fe65

Browse files
committed
Copy configuration & migration to your project
1 parent e0d5e86 commit c43fe65

19 files changed

+2238
-14
lines changed

app/Domains/Social/Jobs/Comments/DiscordCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Foundation\Bus\Dispatchable;
1010
use Illuminate\Queue\InteractsWithQueue;
1111
use Illuminate\Queue\SerializesModels;
12+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1213

1314
/**
1415
* Class DiscordCommentsJob.
@@ -18,7 +19,8 @@ class DiscordCommentsJob implements ShouldQueue
1819
use Dispatchable,
1920
InteractsWithQueue,
2021
Queueable,
21-
SerializesModels;
22+
SerializesModels,
23+
IsMonitored;
2224

2325
/**
2426
* @var Platform

app/Domains/Social/Jobs/Comments/FacebookCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Illuminate\Queue\SerializesModels;
1515
use Illuminate\Support\Facades\Cache;
1616
use Illuminate\Support\Facades\Http;
17+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1718

1819
/**
1920
* Class FacebookCommentsJob.
@@ -23,7 +24,8 @@ class FacebookCommentsJob implements ShouldQueue
2324
use Dispatchable,
2425
InteractsWithQueue,
2526
Queueable,
26-
SerializesModels;
27+
SerializesModels,
28+
IsMonitored;
2729

2830
/**
2931
* @var Platform

app/Domains/Social/Jobs/Comments/PlurkCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Illuminate\Queue\InteractsWithQueue;
1515
use Illuminate\Queue\SerializesModels;
1616
use Illuminate\Support\Facades\Http;
17+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1718

1819
/**
1920
* Class PlurkCommentsJob.
@@ -23,7 +24,8 @@ class PlurkCommentsJob implements ShouldQueue
2324
use Dispatchable,
2425
InteractsWithQueue,
2526
Queueable,
26-
SerializesModels;
27+
SerializesModels,
28+
IsMonitored;
2729

2830
/**
2931
* @var Platform

app/Domains/Social/Jobs/Comments/TelegramCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Foundation\Bus\Dispatchable;
1010
use Illuminate\Queue\InteractsWithQueue;
1111
use Illuminate\Queue\SerializesModels;
12+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1213

1314
/**
1415
* Class TelegramCommentsJob.
@@ -18,7 +19,8 @@ class TelegramCommentsJob implements ShouldQueue
1819
use Dispatchable,
1920
InteractsWithQueue,
2021
Queueable,
21-
SerializesModels;
22+
SerializesModels,
23+
IsMonitored;
2224

2325
/**
2426
* @var Platform

app/Domains/Social/Jobs/Comments/TumblrCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Foundation\Bus\Dispatchable;
1010
use Illuminate\Queue\InteractsWithQueue;
1111
use Illuminate\Queue\SerializesModels;
12+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1213

1314
/**
1415
* Class TumblrCommentsJob.
@@ -18,7 +19,8 @@ class TumblrCommentsJob implements ShouldQueue
1819
use Dispatchable,
1920
InteractsWithQueue,
2021
Queueable,
21-
SerializesModels;
22+
SerializesModels,
23+
IsMonitored;
2224

2325
/**
2426
* @var Platform

app/Domains/Social/Jobs/Comments/TwitterCommentsJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Foundation\Bus\Dispatchable;
1010
use Illuminate\Queue\InteractsWithQueue;
1111
use Illuminate\Queue\SerializesModels;
12+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1213

1314
/**
1415
* Class TwitterCommentsJob.
@@ -18,7 +19,8 @@ class TwitterCommentsJob implements ShouldQueue
1819
use Dispatchable,
1920
InteractsWithQueue,
2021
Queueable,
21-
SerializesModels;
22+
SerializesModels,
23+
IsMonitored;
2224

2325
/**
2426
* @var Platform

app/Domains/Social/Jobs/Publish/DiscordPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Queue\SerializesModels;
1414
use Illuminate\Support\Facades\Http;
1515
use Illuminate\Support\Str;
16+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1617

1718
/**
1819
* Class DiscordPublishJob.
@@ -24,7 +25,8 @@ class DiscordPublishJob implements ShouldQueue
2425
use Dispatchable,
2526
InteractsWithQueue,
2627
Queueable,
27-
SerializesModels;
28+
SerializesModels,
29+
IsMonitored;
2830

2931
/**
3032
* @var Cards

app/Domains/Social/Jobs/Publish/FacebookPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Illuminate\Queue\SerializesModels;
1616
use Illuminate\Support\Facades\Cache;
1717
use Illuminate\Support\Facades\Http;
18+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1819

1920
/**
2021
* Class FacebookPublishJob.
@@ -24,7 +25,8 @@ class FacebookPublishJob implements ShouldQueue
2425
use Dispatchable,
2526
InteractsWithQueue,
2627
Queueable,
27-
SerializesModels;
28+
SerializesModels,
29+
IsMonitored;
2830

2931
/**
3032
* @var Cards

app/Domains/Social/Jobs/Publish/PlurkPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Illuminate\Support\Facades\Http;
1818
use Illuminate\Support\Facades\Storage;
1919
use Illuminate\Support\Str;
20+
use romanzipp\QueueMonitor\Traits\IsMonitored;
2021

2122
/**
2223
* Class PlurkPublishJob.
@@ -28,7 +29,8 @@ class PlurkPublishJob implements ShouldQueue
2829
use Dispatchable,
2930
InteractsWithQueue,
3031
Queueable,
31-
SerializesModels;
32+
SerializesModels,
33+
IsMonitored;
3234

3335
/**
3436
* @var Cards

app/Domains/Social/Jobs/Publish/TelegramPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Illuminate\Queue\InteractsWithQueue;
1414
use Illuminate\Queue\SerializesModels;
1515
use Illuminate\Support\Facades\Http;
16+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1617

1718
/**
1819
* Class TelegramPublishJob.
@@ -22,7 +23,8 @@ class TelegramPublishJob implements ShouldQueue
2223
use Dispatchable,
2324
InteractsWithQueue,
2425
Queueable,
25-
SerializesModels;
26+
SerializesModels,
27+
IsMonitored;
2628

2729
/**
2830
* @var Cards

app/Domains/Social/Jobs/Publish/TumblrPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Illuminate\Queue\InteractsWithQueue;
1616
use Illuminate\Queue\SerializesModels;
1717
use Illuminate\Support\Facades\Http;
18+
use romanzipp\QueueMonitor\Traits\IsMonitored;
1819

1920
/**
2021
* Class TumblrPublishJob.
@@ -26,7 +27,8 @@ class TumblrPublishJob implements ShouldQueue
2627
use Dispatchable,
2728
InteractsWithQueue,
2829
Queueable,
29-
SerializesModels;
30+
SerializesModels,
31+
IsMonitored;
3032

3133
/**
3234
* @var Cards

app/Domains/Social/Jobs/Publish/TwitterPublishJob.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Illuminate\Support\Facades\Http;
1818
use Illuminate\Support\Facades\Storage;
1919
use Illuminate\Support\Str;
20+
use romanzipp\QueueMonitor\Traits\IsMonitored;
2021

2122
/**
2223
* Class TwitterPublishJob.
@@ -28,7 +29,8 @@ class TwitterPublishJob implements ShouldQueue
2829
use Dispatchable,
2930
InteractsWithQueue,
3031
Queueable,
31-
SerializesModels;
32+
SerializesModels,
33+
IsMonitored;
3234

3335
/**
3436
* @var Cards

config/queue-monitor.php

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
return [
4+
/*
5+
* Set the table to be used for monitoring data.
6+
*/
7+
'table' => 'queue_monitor',
8+
'connection' => null,
9+
10+
/*
11+
* Set the model used for monitoring.
12+
* If using a custom model, be sure to implement the
13+
* romanzipp\QueueMonitor\Models\Contracts\MonitorContract
14+
* interface or extend the base model.
15+
*/
16+
'model' => \romanzipp\QueueMonitor\Models\Monitor::class,
17+
18+
/*
19+
* Specify the max character length to use for storing exception backtraces.
20+
*/
21+
'db_max_length_exception' => 4294967295,
22+
'db_max_length_exception_message' => 65535,
23+
24+
/*
25+
* The optional UI settings.
26+
*/
27+
'ui' => [
28+
/*
29+
* Set the monitored jobs count to be displayed per page.
30+
*/
31+
'per_page' => 35,
32+
33+
/*
34+
* Show custom data stored on model
35+
*/
36+
'show_custom_data' => false,
37+
38+
/**
39+
* Allow the deletion of single monitor items.
40+
*/
41+
'allow_deletion' => true,
42+
43+
/**
44+
* Allow purging all monitor entries.
45+
*/
46+
'allow_purge' => true,
47+
48+
'show_metrics' => true,
49+
50+
/**
51+
* Time frame used to calculate metrics values (in days).
52+
*/
53+
'metrics_time_frame' => 14,
54+
],
55+
];
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
/**
8+
* Class CreateQueueMonitorTable.
9+
*
10+
* @extends Migration
11+
*/
12+
class CreateQueueMonitorTable extends Migration
13+
{
14+
/**
15+
* Run the migrations.
16+
*
17+
* @return void
18+
*/
19+
public function up(): void
20+
{
21+
Schema::create(config('queue-monitor.table'), function (Blueprint $table) {
22+
$table->increments('id');
23+
24+
$table->string('job_id')->index();
25+
$table->string('name')->nullable();
26+
$table->string('queue')->nullable();
27+
28+
$table->timestamp('started_at')->nullable()->index();
29+
$table->string('started_at_exact')->nullable();
30+
31+
$table->timestamp('finished_at')->nullable();
32+
$table->string('finished_at_exact')->nullable();
33+
34+
$table->float('time_elapsed', 12, 6)->nullable()->index();
35+
36+
$table->boolean('failed')->default(false)->index();
37+
38+
$table->integer('attempt')->default(0);
39+
$table->integer('progress')->nullable();
40+
41+
$table->longText('exception')->nullable();
42+
$table->text('exception_message')->nullable();
43+
$table->text('exception_class')->nullable();
44+
45+
$table->longText('data')->nullable();
46+
});
47+
}
48+
49+
/**
50+
* Reverse the migrations.
51+
*
52+
* @return void
53+
*/
54+
public function down(): void
55+
{
56+
Schema::drop(config('queue-monitor.table'));
57+
}
58+
}

resources/views/frontend/includes/nav.blade.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,15 @@ class="nav-link dropdown-toggle"
179179
:href="route('admin.dashboard')"
180180
:text="__('Administration')"
181181
class="dropdown-item" />
182-
{{-- OPCache --}}
182+
{{-- OPCache 監控 --}}
183183
<x-utils.link
184184
:href="route('frontend.monitor.opcache.index')"
185-
:text="__('OPCache')"
185+
:text="__('OPCache Monitor')"
186+
class="dropdown-item" />
187+
{{-- Queue 監控 --}}
188+
<x-utils.link
189+
:href="route('frontend.monitor.queue-monitor::index')"
190+
:text="__('Queue Monitor')"
186191
class="dropdown-item" />
187192
@endif
188193

0 commit comments

Comments
 (0)