Skip to content

Commit fd60f0e

Browse files
stayallivecleptric
andauthored
Update default config file with env for everything and added docs (#735)
Co-authored-by: Alex Bouma <[email protected]> Co-authored-by: Michael Hoffmann <[email protected]> Co-authored-by: Michi Hoffmann <[email protected]>
1 parent 2d45a88 commit fd60f0e

File tree

1 file changed

+58
-46
lines changed

1 file changed

+58
-46
lines changed

config/sentry.php

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php
22

3+
/**
4+
* Sentry Laravel SDK configuration file.
5+
*
6+
* @see https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/
7+
*/
38
return [
49

510
// @see https://docs.sentry.io/product/sentry-basics/dsn-explainer/
@@ -9,86 +14,93 @@
914
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
1015
'release' => env('SENTRY_RELEASE'),
1116

12-
// When left empty or `null` the Laravel environment will be used
17+
// When left empty or `null` the Laravel environment will be used (usually discovered from `APP_ENV` in your `.env`)
1318
'environment' => env('SENTRY_ENVIRONMENT'),
1419

20+
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#sample-rate
21+
'sample_rate' => env('SENTRY_SAMPLE_RATE') === null ? 1.0 : (float)env('SENTRY_SAMPLE_RATE'),
22+
23+
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate
24+
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
25+
26+
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#profiles-sample-rate
27+
'profiles_sample_rate' => env('SENTRY_PROFILES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_PROFILES_SAMPLE_RATE'),
28+
29+
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#send-default-pii
30+
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false),
31+
32+
// Breadcrumb specific configuration
1533
'breadcrumbs' => [
16-
// Capture Laravel logs in breadcrumbs
17-
'logs' => true,
34+
// Capture Laravel logs as breadcrumbs
35+
'logs' => env('SENTRY_BREADCRUMBS_LOGS_ENABLED', true),
1836

19-
// Capture Laravel cache events in breadcrumbs
20-
'cache' => true,
37+
// Capture Laravel cache events (hits, writes etc.) as breadcrumbs
38+
'cache' => env('SENTRY_BREADCRUMBS_CACHE_ENABLED', true),
2139

22-
// Capture storage access as breadcrumbs
23-
'storage' => true,
2440

25-
// Capture Livewire components in breadcrumbs
26-
'livewire' => true,
41+
// Capture Livewire components like routes as breadcrumbs
42+
'livewire' => env('SENTRY_BREADCRUMBS_LIVEWIRE_ENABLED', true),
43+
44+
// Capture storage access as breadcrumbs
45+
'storage' => env('SENTRY_BREADCRUMBS_STORAGE_ENABLED', true),
2746

28-
// Capture SQL queries in breadcrumbs
29-
'sql_queries' => true,
47+
// Capture SQL queries as breadcrumbs
48+
'sql_queries' => env('SENTRY_BREADCRUMBS_SQL_QUERIES_ENABLED', true),
3049

31-
// Capture bindings on SQL queries logged in breadcrumbs
32-
'sql_bindings' => false,
50+
// Capture SQL query bindings (parameters) in SQL query breadcrumbs
51+
'sql_bindings' => env('SENTRY_BREADCRUMBS_SQL_BINDINGS_ENABLED', false),
3352

34-
// Capture queue job information in breadcrumbs
35-
'queue_info' => true,
53+
// Capture queue job information as breadcrumbs
54+
'queue_info' => env('SENTRY_BREADCRUMBS_QUEUE_INFO_ENABLED', true),
3655

37-
// Capture command information in breadcrumbs
38-
'command_info' => true,
56+
// Capture command information as breadcrumbs
57+
'command_info' => env('SENTRY_BREADCRUMBS_COMMAND_JOBS_ENABLED', true),
3958

40-
// Capture HTTP client requests information in breadcrumbs
41-
'http_client_requests' => true,
59+
// Capture HTTP client request information as breadcrumbs
60+
'http_client_requests' => env('SENTRY_BREADCRUMBS_HTTP_CLIENT_REQUESTS_ENABLED', true),
4261
],
4362

63+
// Performance monitoring specific configuration
4464
'tracing' => [
45-
// Trace queue jobs as their own transactions
65+
// Trace queue jobs as their own transactions (this enables tracing for queue jobs)
4666
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),
4767

4868
// Capture queue jobs as spans when executed on the sync driver
49-
'queue_jobs' => true,
69+
'queue_jobs' => env('SENTRY_TRACE_QUEUE_JOBS_ENABLED', true),
5070

5171
// Capture SQL queries as spans
52-
'sql_queries' => true,
72+
'sql_queries' => env('SENTRY_TRACE_SQL_QUERIES_ENABLED', true),
5373

54-
// Try to find out where the SQL query originated from and add it to the query spans
55-
'sql_origin' => true,
74+
// Capture where the SQL query originated from on the SQL query spans
75+
'sql_origin' => env('SENTRY_TRACE_SQL_ORIGIN_ENABLED', true),
5676

57-
// Capture views as spans
58-
'views' => true,
77+
// Capture views rendered as spans
78+
'views' => env('SENTRY_TRACE_VIEWS_ENABLED', true),
5979

6080
// Capture storage access as spans
61-
'storage' => true,
81+
'storage' => env('SENTRY_TRACE_STORAGE_ENABLED', true),
6282

6383
// Capture Livewire components as spans
64-
'livewire' => true,
84+
'livewire' => env('SENTRY_TRACE_LIVEWIRE_ENABLED', true),
6585

6686
// Capture HTTP client requests as spans
67-
'http_client_requests' => true,
87+
'http_client_requests' => env('SENTRY_TRACE_HTTP_CLIENT_REQUESTS_ENABLED', true),
6888

6989
// Capture Redis operations as spans (this enables Redis events in Laravel)
7090
'redis_commands' => env('SENTRY_TRACE_REDIS_COMMANDS', false),
7191

72-
// Try to find out where the Redis command originated from and add it to the command spans
73-
'redis_origin' => true,
92+
// Capture where the Redis command originated from on the Redis command spans
93+
'redis_origin' => env('SENTRY_TRACE_REDIS_ORIGIN_ENABLED', true),
7494

75-
// Indicates if the tracing integrations supplied by Sentry should be loaded
76-
'default_integrations' => true,
95+
// Enable tracing for requests without a matching route (404's)
96+
'missing_routes' => env('SENTRY_TRACE_MISSING_ROUTES_ENABLED', false),
7797

78-
// Indicates that requests without a matching route should be traced
79-
'missing_routes' => false,
80-
81-
// Indicates if the performance trace should continue after the response has been sent to the user until the application terminates
98+
// Configures if the performance trace should continue after the response has been sent to the user until the application terminates
8299
// This is required to capture any spans that are created after the response has been sent like queue jobs dispatched using `dispatch(...)->afterResponse()` for example
83-
'continue_after_response' => true,
84-
],
85-
86-
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#send-default-pii
87-
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false),
100+
'continue_after_response' => env('SENTRY_TRACE_CONTINUE_AFTER_RESPONSE', true),
88101

89-
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate
90-
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
91-
92-
'profiles_sample_rate' => env('SENTRY_PROFILES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_PROFILES_SAMPLE_RATE'),
102+
// Enable the tracing integrations supplied by Sentry (recommended)
103+
'default_integrations' => env('SENTRY_TRACE_DEFAULT_INTEGRATIONS_ENABLED', true),
104+
],
93105

94106
];

0 commit comments

Comments
 (0)