Skip to content

Commit

Permalink
Add new PHP config options (#8552)
Browse files Browse the repository at this point in the history
  • Loading branch information
cleptric authored Nov 22, 2023
1 parent 3eeab91 commit ba33d60
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```php {filename:config/sentry.php}
'ignore_exceptions' => [
UnauthenticatedException::class,
],
```
7 changes: 7 additions & 0 deletions src/platform-includes/configuration/ignore-exceptions/php.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```php
\Sentry\init([
'ignore_exceptions' => [
UnauthenticatedException::class,
],
]);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```php {filename:config/sentry.php}
'ignore_transactions' => [
'GET /health',
],
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```php
\Sentry\init([
'ignore_transactions' => [
'GET /health',
],
]);
```
7 changes: 7 additions & 0 deletions src/platform-includes/configuration/logger/php.laravel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```php {filename:config/sentry.php}
// This logs messages to the provided file path
'logger' => new \Sentry\Logger\DebugFileLogger(filePath: storage_path('logs/sentry.log')),

// This logs messages to stdout
'logger' => new \Sentry\Logger\DebugStdOutLogger(),
```
11 changes: 11 additions & 0 deletions src/platform-includes/configuration/logger/php.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```php
// This logs messages to the provided file path
Sentry\init([
'logger' => new \Sentry\Logger\DebugFileLogger(filePath: ROOT . DS . 'sentry.log'),
]);

// This logs messages to stdout
Sentry\init([
'logger' => new \Sentry\Logger\DebugStdOutLogger(),
]);
```
18 changes: 18 additions & 0 deletions src/platforms/common/configuration/filtering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ You can use the <PlatformIdentifier name="ignore-errors" /> option to filter out
<PlatformContent includePath="configuration/ignore-errors" />
</PlatformSection>

<PlatformSection supported={["php"]} >

### Using <PlatformIdentifier name="ignore-exceptions" />

You can use the <PlatformIdentifier name="ignore-exceptions" /> option to filter out errors that match a type or subtype.

<PlatformContent includePath="configuration/ignore-exceptions" />
</PlatformSection>

<PlatformSection supported={["android", "javascript", "java", "python"]} >

### Decluttering Sentry
Expand Down Expand Up @@ -129,4 +138,13 @@ You can use the <PlatformIdentifier name="ignore-transactions" /> option to filt
<PlatformContent includePath="configuration/ignore-transactions" />
</PlatformSection>

<PlatformSection supported={["php"]} >

### Using <PlatformIdentifier name="ignore-transactions" />

You can use the <PlatformIdentifier name="ignore-transactions" /> option to filter out transactions that match a certain string.

<PlatformContent includePath="configuration/ignore-transactions" />
</PlatformSection>

</PlatformSection>
22 changes: 22 additions & 0 deletions src/platforms/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ Turns debug mode on or off. If debug is enabled SDK will attempt to print out us

</ConfigKey>

<ConfigKey name="logger" supported={["php", "php.laravel"]} notSupported={["php.symfony"]}>

If enabled, the SDK prints out debug information about if something went wrong while sending events.
It isn't recommended to use this in production.

<PlatformContent includePath="configuration/logger/" />

</ConfigKey>

<ConfigKey name="diagnostic-level" supported={["dotnet", "java", "android", "dart", "flutter", "apple"]}>

Enabling `debug` mode makes the SDK generate as much diagnostic data as possible. However, if you'd prefer to lower the verbosity of the Sentry SDK diagnostics logs, configure this option to set the appropriate level:
Expand Down Expand Up @@ -293,12 +302,25 @@ For ASP.NET and ASP.NET Core applications, the value will default to the server'

</ConfigKey>

<ConfigKey name="ignore-exceptions" supported={["php"]} notSupported={[]}>

A list of class names that matches exceptions that shouldn't be sent to Sentry.
Checks whether the provided class name is of a given type or subtype.

</ConfigKey>

<ConfigKey name="ignore-transactions" supported={["javascript", "node"]} notSupported={[]}>

<Include name="platforms/configuration/options/ignore-transactions.mdx" />

</ConfigKey>

<ConfigKey name="ignore-transactions" supported={["php"]} notSupported={[]}>

A list of strings that match transaction names that shouldn't be sent to Sentry.

</ConfigKey>

<ConfigKey name="deny-urls" supported={["javascript"]} notSupported={["node"]}>

<Include name="platforms/configuration/options/deny-urls.mdx" />
Expand Down

1 comment on commit ba33d60

@vercel
Copy link

@vercel vercel bot commented on ba33d60 Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev

Please sign in to comment.