Skip to content

Commit 5268a34

Browse files
PeloWriterHazATste93cryJean85
authored
Initial content for Symfony performance integrations (#3470)
* initial content for Symfony performance integrations * ref: Add code snippets * update to enabled * fix typo * update based on feedback * update code samples * Update src/platforms/php/guides/symfony/performance/pm-integrations.mdx Co-authored-by: Stefano Arlandini <[email protected]> * Update src/platforms/php/guides/symfony/performance/pm-integrations.mdx Co-authored-by: Stefano Arlandini <[email protected]> * respond to review feedback * update error types default * respond to review feedback * Update src/platforms/php/guides/symfony/performance/pm-integrations.mdx Co-authored-by: Alessandro Lai <[email protected]> * Update src/platforms/php/guides/symfony/performance/pm-integrations.mdx Co-authored-by: Alessandro Lai <[email protected]> * Update src/platforms/php/common/integrations.mdx Co-authored-by: Alessandro Lai <[email protected]> Co-authored-by: Daniel Griesser <[email protected]> Co-authored-by: Stefano Arlandini <[email protected]> Co-authored-by: Alessandro Lai <[email protected]>
1 parent 688e1bb commit 5268a34

File tree

4 files changed

+91
-27
lines changed

4 files changed

+91
-27
lines changed

src/platforms/php/common/configuration/transports.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ interface;
4343
- The `SpoolTransport` which can be used to defer the sending of events (e.g.
4444
by putting them into a queue).
4545

46-
The examples below pretty much replace the `init()` call.
46+
The examples below pretty much replace the `\Sentry\init()` call.
4747
Please also keep in mind that once a Client is initialized with a Transport it cannot be
4848
changed.
4949

src/platforms/php/common/integrations.mdx

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,49 +8,43 @@ redirect_from:
88

99
## Default Integrations
1010

11-
Default integrations are integrations enabled by default that integrate into the
12-
standard library or the interpreter itself. They are documented so you can see
13-
what they do and that they can be disabled if they cause issues. To disable
14-
system integrations set `default_integrations => false` when calling `init()`.
11+
These integrations are enabled by default and integrate into the
12+
standard library or the interpreter itself. They are documented so you can be both aware of what they do and disable them if they cause issues.
13+
14+
To disable system integrations, set `default_integrations => false` when calling `\Sentry\init()`.
1515

1616
### ExceptionListenerIntegration
1717

1818
This integration catches all global uncaught exceptions and emits events when an error occurs.
1919

20-
To do that, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it
21-
as an exception listener.
20+
To do so, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it as an exception listener.
2221

2322
### ErrorListenerIntegration
2423

2524
This integration hooks into the global PHP `error_handler` and emits events when an error occurs.
2625

27-
To do that, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it
28-
as an error listener. By default, the `ErrorHandler` reserves 10 kilobytes of memory to handle
29-
fatal errors.
26+
To do so, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it as an error listener. By default, the `ErrorHandler` reserves 10 kilobytes of memory to handle fatal errors.
27+
28+
For some frameworks or projects, specific integrations are provided both officially and by third-party users that automatically register the error handlers. Please refer to their documentation.
3029

31-
For some frameworks or projects, there are specific integrations provided both
32-
officially and by third-party users that automatically register the error
33-
handlers. In that case, please refer to their documentation.
30+
By default, the error_types option defaults to the value returned by the `error_reporting()` function, which can change at runtime. Alternately, you can set the option to a fixed value by setting its value to a bitmask of the PHP `E_*` constants in `\Sentry\init()`. In this case, Sentry will log only errors of those specific types regardless of the current reporting level.
3431

35-
Also, by default `E_ALL` will be handled, you can change it by setting `error_types`
36-
a different constant in `init()`.
3732

3833
### FatalErrorListenerIntegration
3934

4035
This integration catches all fatal errors and emits the corresponding events.
4136

42-
To do that, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it
43-
as a fatal error listener.
37+
To do so, it ensures that Sentry's `ErrorHandler` is registered, and adds a callback to it as a fatal error listener.
4438

4539
### RequestIntegration
4640

47-
This integration adds to the event request data like:
41+
This integration adds to the event request data:
4842

4943
- HTTP method
5044
- URL (including the query string)
5145
- Body (by default only if the body is 10Kb or less)
5246

53-
If the [`send_default_pii` option](../configuration/options/#send-default-pii) is enabled, it will also send PII information like:
47+
If the [`send_default_pii` option](../configuration/options/#send-default-pii) is enabled, it will also send the following PII:
5448

5549
- IP address
5650
- Cookies
@@ -68,12 +62,11 @@ This integration reads excerpts of code around the line that originated an error
6862

6963
This integration fills the event data with PHP runtime and server OS information.
7064

71-
7265
## Optional Integrations
7366

74-
You can enable option integration by passing them to the `integrations` option when initializing the Sentry SDK.
67+
You can enable these integrations by passing them to the `integrations` option when initializing the Sentry SDK.
7568

76-
In the example below we add the optional `ModulesIntegration`.
69+
In this example, the optional `ModulesIntegration` is added:
7770

7871
```php
7972
\Sentry\init([
@@ -90,14 +83,13 @@ This integration decides whether an event should not be captured according to a
9083

9184
### ModulesIntegration
9285

93-
This integration logs with the event details all the versions of the packages installed with Composer; the root project is included too.
94-
86+
This integration logs all the versions of the packages installed with Composer with the event details; the root project is also included.
9587

96-
## Customize Integrations
88+
## Custom Integrations
9789

98-
It is also possible to customize the list of integration without disabling the default integration using the `integrations` option and passing a callable.
90+
You can customize the list of integration without disabling the default integration using the `integrations` option. You can pass a callable for advanced needs, though a fixed list of integrations will work in most use cases.
9991

100-
In the example below we leave all integrations enabled exception for the `ExceptionListenerIntegration` and add the `ModulesIntegration`.
92+
In the example below, all integrations are enabled except the `ExceptionListenerIntegration`. In addition, the `ModulesIntegration` is added.
10193

10294
```php
10395
\Sentry\init([

src/platforms/php/guides/symfony/index.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ SENTRY_DSN="___PUBLIC_DSN___"
4848
###< sentry/sentry-symfony ###
4949
```
5050

51+
<Alert level= "warning" title="Performance">
52+
53+
Performance monitoring integrations to support tracing are enabled by default. To use them, update to the latest version of the SDK.
54+
55+
These integrations hook into critical paths of the framework and of the vendors. As a result, there may be a performance penalty. To disable tracing, please see the [Integrations documentation](/platforms/php/guides/symfony/performance/pm-integrations/).
56+
57+
</Alert>
58+
5159
If you **are not** using Symfony Flex, you'll also need to enable the bundle in `config/bundles.php`:
5260

5361
```php {filename:config/bundles.php}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Performance Integrations
3+
description: "Learn about the the integrations Sentry provides for performance monitoring and how to configure them."
4+
sidebar_order: 500
5+
---
6+
7+
The Symfony SDK offers integrations to support tracing that are enabled by default. To use them, update to the latest version of the SDK.
8+
9+
If the vendors (DBAL, Cache, and Twig) are installed, `enabled` will be set to `true`, so it's likely that this configuration is the same in your app.
10+
11+
These integrations are hooking into critical paths of the framework and of the vendors. As a result, there may be a performance penalty. If you are updating from a previous version or installing the SDK, you may observe a degradation of your app performance, though it may not be noticeable. If you need to disable tracing, you can do so by setting `enabled` to `false`.
12+
13+
```yaml {filename:config/packages/sentry.yaml}
14+
sentry:
15+
tracing:
16+
enabled: true
17+
dbal: # DB queries
18+
enabled: true
19+
cache:
20+
enabled: true
21+
twig: # templating engine
22+
enabled: true
23+
```
24+
25+
You can adjust the integrations to your needs if you want to disable a specific integration.
26+
27+
### DBAL
28+
29+
This integration supports tracking database queries as Spans. Enabling this option will create Spans for your queries.
30+
31+
It is enabled by default. To disable tracking database queries, set `enabled` to `false`.
32+
33+
```yaml {filename:config/packages/sentry.yaml}
34+
sentry:
35+
tracing:
36+
dbal: # DB queries
37+
enabled: true
38+
```
39+
40+
### Twig
41+
42+
This integration adds distributed tracing for Twig template rendering using Sentry.
43+
44+
It is enabled by default. To disable it, set `enabled` to `false`.
45+
46+
```yaml {filename:config/packages/sentry.yaml}
47+
sentry:
48+
tracing:
49+
twig: # templating engine
50+
enabled: true
51+
```
52+
53+
### Cache
54+
55+
This integration adds support for distributed tracing of cache pools.
56+
57+
It is enabled by default. To disable it, set `enabled` to `false`.
58+
59+
```yaml {filename:config/packages/sentry.yaml}
60+
sentry:
61+
tracing:
62+
cache: # cache pools
63+
enabled: true
64+
```

0 commit comments

Comments
 (0)