From 0fd80a9c8ec8aea59a67fb5f208b3f65a045d9ce Mon Sep 17 00:00:00 2001 From: Michi Hoffmann Date: Tue, 9 Apr 2024 07:13:40 +0200 Subject: [PATCH] Prepare 5.0.0 (#829) --- CHANGELOG.md | 112 ++++++++++++++++++++++++++++++++++++++++++++++--- UPGRADE-5.0.md | 54 ++++++++++++++++++++++++ 2 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 UPGRADE-5.0.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6767db3e..27d2b5e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,115 @@ -# Changelog - ## 5.0.0 -The Sentry SDK team is happy to announce the immediate availability of Sentry Symfony SDK v5.0.0. +The Sentry SDK team is thrilled to announce the immediate availability of Sentry Symfony SDK v5.0.0. + +### Breaking Change + +Please refer to the [UPGRADE-5.0.md](https://github.com/getsentry/sentry-symfony/blob/master/UPGRADE-5.0.md) guide for a complete list of breaking changes. + +This version adds support for the underlying [Sentry PHP SDK v4.0](https://github.com/getsentry/sentry-php). +Please refer to the PHP SDK [sentry-php/UPGRADE-4.0.md](https://github.com/getsentry/sentry-php/blob/master/UPGRADE-4.0.md) guide for a complete list of breaking changes. + +- This version exclusively uses the [envelope endpoint](https://develop.sentry.dev/sdk/envelopes/) to send event data to Sentry. + + If you are using [sentry.io](https://sentry.io), no action is needed. + If you are using an on-premise/self-hosted installation of Sentry, the minimum requirement is now version `>= v20.6.0`. + +- You need to have `ext-curl` installed to use the SDK. -### Breaking Changes +- The `IgnoreErrorsIntegration` integration was removed. Use the `ignore_exceptions` option instead. + Previously, both `Symfony\Component\ErrorHandler\Error\FatalError` and `Symfony\Component\Debug\Exception\FatalErrorException` were ignored by default. + To continue ignoring these exceptions, make the following changes to the config file: + + ```yaml + // config/packages/sentry.yaml + + sentry: + options: + ignore_exceptions: + - 'Symfony\Component\ErrorHandler\Error\FatalError' + - 'Symfony\Component\Debug\Exception\FatalErrorException' + ``` + + This option performs an [`is_a`](https://www.php.net/manual/en/function.is-a.php) check now, so you can also ignore more generic exceptions. ### Features -### Bug Fixes +- Add support for Sentry Developer Metrics [(#1619)](https://github.com/getsentry/sentry-php/pull/1619) + + ```php + use function Sentry\metrics; + + // Add 4 to a counter named hits + metrics()->increment(key: 'hits', value: 4); + + // Add 25 to a distribution named response_time with unit milliseconds + metrics()->distribution(key: 'response_time', value: 25, unit: MetricsUnit::millisecond()); + + // Add 2 to gauge named parallel_requests, tagged with type: "a" + metrics()->gauge(key: 'parallel_requests', value: 2, tags: ['type': 'a']); + + // Add a user's email to a set named users.sessions, tagged with role: "admin" + metrics()->set('users.sessions', 'jane.doe@example.com', null, ['role' => User::admin()]); + ``` + + Metrics are automatically sent to Sentry at the end of a request, hooking into Symfony's `kernel.terminate` event. + +- Add new fluent APIs [(#1601)](https://github.com/getsentry/sentry-php/pull/1601) + + ```php + // Before + $transactionContext = new TransactionContext(); + $transactionContext->setName('GET /example'); + $transactionContext->setOp('http.server'); + + // After + $transactionContext = (new TransactionContext()) + ->setName('GET /example'); + ->setOp('http.server'); + ``` + +- Simplify the breadcrumb API [(#1603)](https://github.com/getsentry/sentry-php/pull/1603) + + ```php + // Before + \Sentry\addBreadcrumb( + new \Sentry\Breadcrumb( + \Sentry\Breadcrumb::LEVEL_INFO, + \Sentry\Breadcrumb::TYPE_DEFAULT, + 'auth', // category + 'User authenticated', // message (optional) + ['user_id' => $userId] // data (optional) + ) + ); + + // After + \Sentry\addBreadcrumb( + category: 'auth', + message: 'User authenticated', // optional + metadata: ['user_id' => $userId], // optional + level: Breadcrumb::LEVEL_INFO, // set by default + type: Breadcrumb::TYPE_DEFAULT, // set by default + ); + ``` + +- New default cURL HTTP client [(#1589)](https://github.com/getsentry/sentry-php/pull/1589) + + The SDK now ships with its own HTTP client based on cURL. A few new options were added. + + ```yaml + // config/packages/sentry.yaml + + sentry: + options: + - http_proxy_authentication: 'username:password' // user name and password to use for proxy authentication + - http_ssl_verify_peer: false // default true, verify the peer's SSL certificate + - http_compression: false // default true, http request body compression + ``` + + To use a different client, you may use the `http_client` option. + To use a different transport, you may use the `transport` option. A custom transport must implement the `TransportInterface`. + If you use the `transport` option, the `http_client` option has no effect. ### Misc + +- The abandoned package `php-http/message-factory` was removed. diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md new file mode 100644 index 00000000..5737c2cc --- /dev/null +++ b/UPGRADE-5.0.md @@ -0,0 +1,54 @@ +# Upgrade 4.x to 5.0 + +This version adds support for the underlying [Sentry PHP SDK v4.0](https://github.com/getsentry/sentry-php). +Please refer to the PHP SDK [sentry-php/UPGRADE-4.0.md](https://github.com/getsentry/sentry-php/blob/master/UPGRADE-4.0.md) guide for a complete list of breaking changes. + +- This version exclusively uses the [envelope endpoint](https://develop.sentry.dev/sdk/envelopes/) to send event data to Sentry. + + If you are using [sentry.io](https://sentry.io), no action is needed. + If you are using an on-premise/self-hosted installation of Sentry, the minimum requirement is now version `>= v20.6.0`. + +- You need to have `ext-curl` installed to use the SDK. + +- The `IgnoreErrorsIntegration` integration was removed. Use the `ignore_exceptions` option instead. + Previously, both `Symfony\Component\ErrorHandler\Error\FatalError` and `Symfony\Component\Debug\Exception\FatalErrorException` were ignored by default. + To continue ignoring these exceptions, make the following changes to your `config/packages/sentry.yaml` file: + + ```yaml + // config/packages/sentry.yaml + + sentry: + options: + ignore_exceptions: + - 'Symfony\Component\ErrorHandler\Error\FatalError' + - 'Symfony\Component\Debug\Exception\FatalErrorException' + ``` + + This option performs an [`is_a`](https://www.php.net/manual/en/function.is-a.php) check now, so you can also ignore more generic exceptions. + +- Removed support for `guzzlehttp/psr7: ^1.8.4`. + +- The `RequestFetcher` now relies on `guzzlehttp/psr7: ^2.1.1`. + +- Continue traces from the W3C `traceparent` request header. +- Inject the W3C `traceparent` header on outgoing HTTP client calls. +- Added `Sentry\SentryBundle\Twig\SentryExtension::getW3CTraceMeta()`. + +- The new default value for the `sentry.options.trace_propagation_targets` option is now `null`. To not attach any headers to outgoing requests, set this option to `[]`. + +- Added the `sentry.options.enable_tracing` option. +- Added the `sentry.options.attach_metric_code_locations` option. +- Added the `sentry.options.spotlight` option. +- Added the `sentry.options.spotlight_url` option. +- Added the `sentry.options.transport` option. +- Added the `sentry.options.http_client` option. +- Added the `sentry.options.http_proxy_authentication` option. +- Added the `sentry.options.http_ssl_verify_peer` option. +- Added the `sentry.options.http_compression` option. + +- Removed the `sentry.transport_factory` option. Use `sentry.options.transport` to use a custom transport. +- Removed the `sentry.options.send_attempts` option. You may use a custom transport if you rely on this behaviour. +- Removed the `sentry.options.enable_compression` option. Use `sentry.options.http_compression` instead. + +- Removed `Sentry\SentryBundle\Transport\TransportFactory`. +- Removed `Sentry\State\HubInterface\Sentry\State\HubInterface`.