telescope install for monitoring

pull/29/head
shahnewazIbrahim 2 years ago
parent ab0be2273c
commit e522d2f18c

@ -56,3 +56,4 @@ SANCTUM_STATEFUL_DOMAINS="localhost,localhost:3000,localhost:8000,127.0.0.1,127.
DEFAULT_ROLE_SLUG=user
DELETE_PREVIOUS_ACCESS_TOKENS_ON_LOGIN=false
TELESCOPE_ENABLED=true

@ -0,0 +1 @@
{"version":1,"defects":[],"times":{"Tests\\Unit\\ExampleTest::test_that_true_is_true":0.016,"Tests\\Feature\\AdminLoginTest::test_admin_login":0.14,"Tests\\Feature\\AdminLoginTest::test_admin_login_fail":0.076,"Tests\\Feature\\HelloHydraTest::test_hello_hydra":0.002,"Tests\\Feature\\HelloHydraTest::test_hydra_version":0.001,"Tests\\Feature\\RoleTest::test_list_roles":0.111,"Tests\\Feature\\RoleTest::test_update_role_name_as_admin":0.098,"Tests\\Feature\\RoleTest::test_update_role_slug_as_admin":0.129,"Tests\\Feature\\RoleTest::test_update_role_namd_and_slug_as_admin":0.158,"Tests\\Feature\\RoleTest::test_update_admin_slug_as_admin_should_fail":0.169,"Tests\\Feature\\RoleTest::test_create_new_role_as_admin":0.132,"Tests\\Feature\\RoleTest::test_duplicate_role_will_not_be_created":0.117,"Tests\\Feature\\RoleTest::test_delete_role_as_admin":0.123,"Tests\\Feature\\RoleTest::test_delete_admin_role_should_fail":0.101,"Tests\\Feature\\UserRoleTest::test_user_role_is_present":0.084,"Tests\\Feature\\UserRoleTest::test_assign_role_to_a_user":0.135,"Tests\\Feature\\UserRoleTest::test_assign_role_multiple_times_to_a_user_should_fail":0.221,"Tests\\Feature\\UserRoleTest::test_assign_multiple_roles_to_a_user":0.149,"Tests\\Feature\\UserRoleTest::test_delete_role_from_a_user":0.172,"Tests\\Feature\\UserRoleTest::test_delete_all_roles_from_a_user":0.17,"Tests\\Feature\\UserTest::test_new_user_registration":0.12,"Tests\\Feature\\UserTest::test_existing_email_registration_fail":0.017,"Tests\\Feature\\UserTest::test_new_user_login":0.039,"Tests\\Feature\\UserTest::test_new_user_failed_login":0.022,"Tests\\Feature\\UserTest::test_new_user_name_update_with_user_token":0.11,"Tests\\Feature\\UserTest::test_new_user_name_update_with_admin_token":0.112,"Tests\\Feature\\UserTest::test_new_user_destroy_as_user_should_fail":0.055,"Tests\\Feature\\UserTest::test_new_user_destroy_as_admin":0.111,"Tests\\Feature\\UserTest::test_delete_admin_user_if_multiple_admins_are_present":0.158}}

@ -0,0 +1,65 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Laravel\Telescope\TelescopeApplicationServiceProvider;
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
// Telescope::night();
$this->hideSensitiveRequestDetails();
Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local')) {
return true;
}
return $entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
}
/**
* Prevent sensitive request details from being logged by Telescope.
*/
protected function hideSensitiveRequestDetails(): void
{
if ($this->app->environment('local')) {
return;
}
Telescope::hideRequestParameters(['_token']);
Telescope::hideRequestHeaders([
'cookie',
'x-csrf-token',
'x-xsrf-token',
]);
}
/**
* Register the Telescope gate.
*
* This gate determines who can access Telescope in non-local environments.
*/
protected function gate(): void
{
Gate::define('viewTelescope', function ($user) {
return in_array($user->email, [
//
]);
});
}
}

@ -18,6 +18,7 @@
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.1.0",
"laravel/sail": "^1.15",
"laravel/telescope": "^4.17",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0",

@ -194,6 +194,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
App\Providers\TelescopeServiceProvider::class,
],

@ -0,0 +1,189 @@
<?php
use Laravel\Telescope\Http\Middleware\Authorize;
use Laravel\Telescope\Watchers;
return [
/*
|--------------------------------------------------------------------------
| Telescope Domain
|--------------------------------------------------------------------------
|
| This is the subdomain where Telescope will be accessible from. If the
| setting is null, Telescope will reside under the same domain as the
| application. Otherwise, this value will be used as the subdomain.
|
*/
'domain' => env('TELESCOPE_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Telescope Path
|--------------------------------------------------------------------------
|
| This is the URI path where Telescope will be accessible from. Feel free
| to change this path to anything you like. Note that the URI will not
| affect the paths of its internal API that aren't exposed to users.
|
*/
'path' => env('TELESCOPE_PATH', 'telescope'),
/*
|--------------------------------------------------------------------------
| Telescope Storage Driver
|--------------------------------------------------------------------------
|
| This configuration options determines the storage driver that will
| be used to store Telescope's data. In addition, you may set any
| custom options as needed by the particular driver you choose.
|
*/
'driver' => env('TELESCOPE_DRIVER', 'database'),
'storage' => [
'database' => [
'connection' => env('DB_CONNECTION', 'mysql'),
'chunk' => 1000,
],
],
/*
|--------------------------------------------------------------------------
| Telescope Master Switch
|--------------------------------------------------------------------------
|
| This option may be used to disable all Telescope watchers regardless
| of their individual configuration, which simply provides a single
| and convenient way to enable or disable Telescope data storage.
|
*/
'enabled' => env('TELESCOPE_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Telescope Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Telescope route, giving you
| the chance to add your own middleware to this list or change any of
| the existing middleware. Or, you can simply stick with this list.
|
*/
'middleware' => [
'web',
Authorize::class,
],
/*
|--------------------------------------------------------------------------
| Allowed / Ignored Paths & Commands
|--------------------------------------------------------------------------
|
| The following array lists the URI paths and Artisan commands that will
| not be watched by Telescope. In addition to this list, some Laravel
| commands, like migrations and queue commands, are always ignored.
|
*/
'only_paths' => [
// 'api/*'
],
'ignore_paths' => [
'livewire*',
'nova-api*',
'pulse*',
],
'ignore_commands' => [
//
],
/*
|--------------------------------------------------------------------------
| Telescope Watchers
|--------------------------------------------------------------------------
|
| The following array lists the "watchers" that will be registered with
| Telescope. The watchers gather the application's profile data when
| a request or task is executed. Feel free to customize this list.
|
*/
'watchers' => [
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
Watchers\CacheWatcher::class => [
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
'hidden' => [],
],
Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
Watchers\CommandWatcher::class => [
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
'ignore' => [],
],
Watchers\DumpWatcher::class => [
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
],
Watchers\EventWatcher::class => [
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
'ignore' => [],
],
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
Watchers\GateWatcher::class => [
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
'ignore_abilities' => [],
'ignore_packages' => true,
'ignore_paths' => [],
],
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
Watchers\LogWatcher::class => [
'enabled' => env('TELESCOPE_LOG_WATCHER', true),
'level' => 'error',
],
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
Watchers\ModelWatcher::class => [
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
'events' => ['eloquent.*'],
'hydrations' => true,
],
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
Watchers\QueryWatcher::class => [
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
'ignore_packages' => true,
'ignore_paths' => [],
'slow' => 100,
],
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
Watchers\RequestWatcher::class => [
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
'ignore_http_methods' => [],
'ignore_status_codes' => [],
],
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
],
];

2
package-lock.json generated

@ -1,5 +1,5 @@
{
"name": "hydra",
"name": "api_kickstart",
"lockfileVersion": 3,
"requires": true,
"packages": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

@ -0,0 +1,5 @@
{
"/app.js": "/app.js?id=613c227dfb4d6e1fc4db1b1a90513610",
"/app-dark.css": "/app-dark.css?id=b11fa9a28e9d3aeb8c92986f319b3c44",
"/app.css": "/app.css?id=b3ccfbe68f24cff776f83faa8dead721"
}
Loading…
Cancel
Save