From 1d0e3ea82a6b062255d4f3ffebdf723a4d6b9fed Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 3 Mar 2026 10:49:59 +0100 Subject: [PATCH] Update sentry configuration --- .env.example | 10 ++++ config/sentry.php | 132 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 109 insertions(+), 33 deletions(-) diff --git a/.env.example b/.env.example index d9351be02..2657685c4 100644 --- a/.env.example +++ b/.env.example @@ -208,6 +208,16 @@ OTP_ENABLED=false FLARE_KEY= +# Sentry Error Monitoring +SENTRY_LARAVEL_DSN= +SENTRY_RELEASE= +SENTRY_ENVIRONMENT= +SENTRY_SAMPLE_RATE=1.0 +SENTRY_TRACES_SAMPLE_RATE= +SENTRY_PROFILES_SAMPLE_RATE= +SENTRY_ENABLE_LOGS=false +SENTRY_SEND_DEFAULT_PII=false + CHECK_PASSWORDED_RARS=false DELETE_PASSWORDED_RELEASES=false DELETE_POSSIBLE_PASSWORDED_RELEASES=false diff --git a/config/sentry.php b/config/sentry.php index d9975e661..5a769415d 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -1,57 +1,123 @@ env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), - // capture release as git sha - // 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')), + // The release version of your application + // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) + 'release' => env('SENTRY_RELEASE'), - // When left empty or `null` the Laravel environment will be used + // When left empty or `null` the Laravel environment will be used (usually discovered from `APP_ENV` in your `.env`) 'environment' => env('SENTRY_ENVIRONMENT'), - 'breadcrumbs' => [ - // Capture Laravel logs in breadcrumbs - 'logs' => true, + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#sample_rate + 'sample_rate' => env('SENTRY_SAMPLE_RATE') === null ? 1.0 : (float) env('SENTRY_SAMPLE_RATE'), - // Capture SQL queries in breadcrumbs - 'sql_queries' => true, + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces_sample_rate + 'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_TRACES_SAMPLE_RATE'), - // Capture bindings on SQL queries logged in breadcrumbs - 'sql_bindings' => true, + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#profiles_sample_rate + 'profiles_sample_rate' => env('SENTRY_PROFILES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_PROFILES_SAMPLE_RATE'), - // Capture queue job information in breadcrumbs - 'queue_info' => true, + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#enable_logs + 'enable_logs' => env('SENTRY_ENABLE_LOGS', false), - // Capture command information in breadcrumbs - 'command_info' => true, + // The minimum log level that will be sent to Sentry as logs using the `sentry_logs` logging channel + 'logs_channel_level' => env('SENTRY_LOG_LEVEL', env('SENTRY_LOGS_LEVEL', env('LOG_LEVEL', 'debug'))), + + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#send_default_pii + 'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false), + + // @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#ignore_transactions + 'ignore_transactions' => [ + // Ignore Laravel's default health URL + '/up', ], + // Breadcrumb specific configuration + 'breadcrumbs' => [ + // Capture Laravel logs as breadcrumbs + 'logs' => env('SENTRY_BREADCRUMBS_LOGS_ENABLED', true), + + // Capture Laravel cache events (hits, writes etc.) as breadcrumbs + 'cache' => env('SENTRY_BREADCRUMBS_CACHE_ENABLED', true), + + // Capture Livewire components like routes as breadcrumbs + 'livewire' => env('SENTRY_BREADCRUMBS_LIVEWIRE_ENABLED', true), + + // Capture SQL queries as breadcrumbs + 'sql_queries' => env('SENTRY_BREADCRUMBS_SQL_QUERIES_ENABLED', true), + + // Capture SQL query bindings (parameters) in SQL query breadcrumbs + 'sql_bindings' => env('SENTRY_BREADCRUMBS_SQL_BINDINGS_ENABLED', false), + + // Capture queue job information as breadcrumbs + 'queue_info' => env('SENTRY_BREADCRUMBS_QUEUE_INFO_ENABLED', true), + + // Capture command information as breadcrumbs + 'command_info' => env('SENTRY_BREADCRUMBS_COMMAND_JOBS_ENABLED', true), + + // Capture HTTP client request information as breadcrumbs + 'http_client_requests' => env('SENTRY_BREADCRUMBS_HTTP_CLIENT_REQUESTS_ENABLED', true), + + // Capture send notifications as breadcrumbs + 'notifications' => env('SENTRY_BREADCRUMBS_NOTIFICATIONS_ENABLED', true), + ], + + // Performance monitoring specific configuration 'tracing' => [ - // Trace queue jobs as their own transactions - 'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false), + // Trace queue jobs as their own transactions (this enables tracing for queue jobs) + 'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', true), // Capture queue jobs as spans when executed on the sync driver - 'queue_jobs' => true, + 'queue_jobs' => env('SENTRY_TRACE_QUEUE_JOBS_ENABLED', true), // Capture SQL queries as spans - 'sql_queries' => true, + 'sql_queries' => env('SENTRY_TRACE_SQL_QUERIES_ENABLED', true), - // Try to find out where the SQL query originated from and add it to the query spans - 'sql_origin' => true, + // Capture SQL query bindings (parameters) in SQL query spans + 'sql_bindings' => env('SENTRY_TRACE_SQL_BINDINGS_ENABLED', false), - // Capture views as spans - 'views' => true, + // Capture where the SQL query originated from on the SQL query spans + 'sql_origin' => env('SENTRY_TRACE_SQL_ORIGIN_ENABLED', true), - // Indicates if the tracing integrations supplied by Sentry should be loaded - 'default_integrations' => true, + // Define a threshold in milliseconds for SQL queries to resolve their origin + 'sql_origin_threshold_ms' => env('SENTRY_TRACE_SQL_ORIGIN_THRESHOLD_MS', 100), + + // Capture views rendered as spans + 'views' => env('SENTRY_TRACE_VIEWS_ENABLED', true), + + // Capture Livewire components as spans + 'livewire' => env('SENTRY_TRACE_LIVEWIRE_ENABLED', true), + + // Capture HTTP client requests as spans + 'http_client_requests' => env('SENTRY_TRACE_HTTP_CLIENT_REQUESTS_ENABLED', true), + + // Capture Laravel cache events (hits, writes etc.) as spans + 'cache' => env('SENTRY_TRACE_CACHE_ENABLED', true), + + // Capture Redis operations as spans (this enables Redis events in Laravel) + 'redis_commands' => env('SENTRY_TRACE_REDIS_COMMANDS', false), + + // Capture where the Redis command originated from on the Redis command spans + 'redis_origin' => env('SENTRY_TRACE_REDIS_ORIGIN_ENABLED', true), + + // Capture send notifications as spans + 'notifications' => env('SENTRY_TRACE_NOTIFICATIONS_ENABLED', true), + + // Enable tracing for requests without a matching route (404's) + 'missing_routes' => env('SENTRY_TRACE_MISSING_ROUTES_ENABLED', false), + + // Configures if the performance trace should continue after the response has been sent + 'continue_after_response' => env('SENTRY_TRACE_CONTINUE_AFTER_RESPONSE', true), + + // Enable the tracing integrations supplied by Sentry (recommended) + 'default_integrations' => env('SENTRY_TRACE_DEFAULT_INTEGRATIONS_ENABLED', true), ], - - // @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii - 'send_default_pii' => false, - - 'traces_sample_rate' => (float) (env('SENTRY_TRACES_SAMPLE_RATE', 0.0)), - - 'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'), - ];