Skip to content

Update the dependencies and require the SDK 3.x #385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
php:
- '7.4'
- '7.3'
- '7.2'
- '7.1'
sentry_constraint: [false]
symfony_constraint: [false]
experimental: [false]
Expand All @@ -30,12 +30,12 @@ jobs:
php: '7.3'
symfony_constraint: 4.4.*
- description: 'Symfony 3.4'
php: '7.1'
php: '7.2'
symfony_constraint: 3.4.*
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
- description: 'prefer lowest'
php: '7.1'
php: '7.2'
composer_option: '--prefer-lowest'
symfony_constraint: 3.4.*
env:
Expand All @@ -47,7 +47,7 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: ${{ matrix.php }}-${{ matrix.symfony_constraint }}-${{ matrix.composer_option }}
key: ${{ matrix.php }}-${{ matrix.symfony_constraint }}-${{ matrix.composer_option }}
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand Down
104 changes: 60 additions & 44 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,103 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## Unreleased
- CLI commands registration policy changed to lazy load

- Enable back all error listeners from base SDK integration (#322)
- Added `options.traces_sampler` and `options.traces_sample_rate` configuration options (#385)
- [BC BREAK] Removed the `options.project_root` configuration option. Instead of setting it, use a combination of `options.in_app_include` and `options.in_app_exclude` (#385)
- [BC BREAK] Removed the `options.excluded_exceptions` configuration option. Instead of setting it, configure the `IgnoreErrorsIntegration` integration (#385)
- CLI commands registration policy changed to lazy load

## 3.5.3 (2020-10-13)
- Refactors and fixes class aliases for more robustness (#315 #359, thanks to @guilliamxavier)

- Refactors and fixes class aliases for more robustness (#315 #359, thanks to @guilliamxavier)

## 3.5.2 (2020-07-08)
- Use `jean85/pretty-package-versions` `^1.5` to leverage the new `getRootPackageVersion` method (c8799ac)
- Fix support for PHP preloading (#354, thanks to @annuh)
- Fix `capture_soft_fails: false` option for the Messenger (#353)

## 4.0.0 (TBA)
- Enable back all error listeners from base SDK integration (#322)
- Use `jean85/pretty-package-versions` `^1.5` to leverage the new `getRootPackageVersion` method (c8799ac)
- Fix support for PHP preloading (#354, thanks to @annuh)
- Fix `capture_soft_fails: false` option for the Messenger (#353)

## 3.5.1 (2020-05-07)
- Capture events using the `Hub` in the `MessengerListener` to avoid loosing `Scope` data (#339, thanks to @sh41)
- Capture multiple events if multiple exceptions are generated in a Messenger Worker context (#340, thanks to @emarref)

- Capture events using the `Hub` in the `MessengerListener` to avoid loosing `Scope` data (#339, thanks to @sh41)
- Capture multiple events if multiple exceptions are generated in a Messenger Worker context (#340, thanks to @emarref)

## 3.5.0 (2020-05-04)
- Capture and flush messages in a Messenger Worker context (#326, thanks to @emarref)
- Support Composer 2 (#335)
- Avoid issues with dependency lower bound, fix #331 (#335)

- Capture and flush messages in a Messenger Worker context (#326, thanks to @emarref)
- Support Composer 2 (#335)
- Avoid issues with dependency lower bound, fix #331 (#335)

## 3.4.4 (2020-03-16)
- Improve `release` option default value (#325)

- Improve `release` option default value (#325)

## 3.4.3 (2020-02-03)
- Change default of `in_app_include` to empty, due to getsentry/sentry-php#958 (#311)
- Improve class_alias robustness (#315)

- Change default of `in_app_include` to empty, due to getsentry/sentry-php#958 (#311)
- Improve class_alias robustness (#315)

## 3.4.2 (2020-01-29)
- Remove space from classname used with `class_alias` (#313)

- Remove space from classname used with `class_alias` (#313)

## 3.4.1 (2020-01-24)
- Fix issue due to usage of `class_alias` to fix deprecations, which could break BC layers of third party packages (#309, thanks to @scheb)

- Fix issue due to usage of `class_alias` to fix deprecations, which could break BC layers of third party packages (#309, thanks to @scheb)

## 3.4.0 (2020-01-20)
- Add support for `sentry/sentry` 2.3 (#298)
- Drop support for `sentry/sentry` < 2.3 (#298)
- Add support to `in_app_include` client option (#298)
- Remap `excluded_exceptions` option to use the new `IgnoreErrorsIntegration` (#298)

- Add support for `sentry/sentry` 2.3 (#298)
- Drop support for `sentry/sentry` < 2.3 (#298)
- Add support to `in_app_include` client option (#298)
- Remap `excluded_exceptions` option to use the new `IgnoreErrorsIntegration` (#298)

## 3.3.2 (2020-01-16)
- Fix issue with exception listener under Symfony 4.3 (#301)

- Fix issue with exception listener under Symfony 4.3 (#301)

## 3.3.1 (2020-01-14)
- Fixed Release

- Fixed Release

## 3.3.0 (2020-01-14)
- Add support for Symfony 5.0 (#266, thanks to @Big-Shark)
- Drop support for Symfony < 3.4 (#277)
- Add default value for the `release` option, using the detected root package version (#291 #292, thanks to @Ocramius)

- Add support for Symfony 5.0 (#266, thanks to @Big-Shark)
- Drop support for Symfony < 3.4 (#277)
- Add default value for the `release` option, using the detected root package version (#291 #292, thanks to @Ocramius)

## 3.2.1 (2019-12-19)
- Fix handling of command with no name on `ConsoleListener` (#261)
- Remove check by AuthorizationChecker in `RequestListener` (#264)
- Fixed undefined variable in `RequestListener` (#263)

- Fix handling of command with no name on `ConsoleListener` (#261)
- Remove check by AuthorizationChecker in `RequestListener` (#264)
- Fixed undefined variable in `RequestListener` (#263)

## 3.2.0 (2019-10-04)
- Add forward compatibility with Symfony 5 (#235, thanks to @garak)
- Fix Hub initialization for `ErrorListener` (#243, thanks to @teohhanhui)
- Fix compatibility with sentry/sentry 2.2+ (#244)
- Add support for `class_serializers` option (#245)
- Add support for `max_request_body_size` option (#249)
- Add option to disable the error listener completely (#247, thanks to @HypeMC)
- Add options to register the Monolog Handler (#247, thanks to @HypeMC)

- Add forward compatibility with Symfony 5 (#235, thanks to @garak)
- Fix Hub initialization for `ErrorListener` (#243, thanks to @teohhanhui)
- Fix compatibility with sentry/sentry 2.2+ (#244)
- Add support for `class_serializers` option (#245)
- Add support for `max_request_body_size` option (#249)
- Add option to disable the error listener completely (#247, thanks to @HypeMC)
- Add options to register the Monolog Handler (#247, thanks to @HypeMC)

## 3.1.0 (2019-07-02)
- Add support for Symfony 2.8 (#233, thanks to @nocive)
- Fix handling of ESI requests (#213, thanks to @franmomu)

- Add support for Symfony 2.8 (#233, thanks to @nocive)
- Fix handling of ESI requests (#213, thanks to @franmomu)

## 3.0.0 (2019-05-10)
- Add the `sentry:test` command, to test if the Sentry SDK is functioning properly.

- Add the `sentry:test` command, to test if the Sentry SDK is functioning properly.

## 3.0.0-beta2 (2019-03-22)
- Disable Sentry's ErrorHandler, and report all errors using Symfony's events (#204)

- Disable Sentry's ErrorHandler, and report all errors using Symfony's events (#204)

## 3.0.0-beta1 (2019-03-06)

The 3.0 major release has multiple breaking changes. The most notable one is the upgrade to the 2.0 base SDK client.
Refer to the [UPGRADE-3.0.md](https://github.com/getsentry/sentry-symfony/blob/master/UPGRADE-3.0.md) document for a
detailed explanation.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ sentry:
options:
environment: '%kernel.environment%'
release: '%env(VERSION)%' #your app version
excluded_exceptions: #exclude validation errors
- App\Exception\UserNotFoundException
- Symfony\Component\Security\Core\Exception\AccessDeniedException
```

The parameter `options` allows to fine-tune exceptions. To discover more options, please refer to
Expand Down
27 changes: 27 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Upgrade 3.x to 4.0

- Removed the `sentry.options.excluded_exceptions` configuration option.

Before:

```yaml
sentry:
options:
excluded_exceptions:
- RuntimeException
```

After:

```yaml
sentry:
integrations:
- '@Sentry\Integration\IgnoreErrorsIntegration'

services:
Sentry\Integration\IgnoreErrorsIntegration:
arguments:
$options:
ignore_exceptions:
- RuntimeException
```
30 changes: 18 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"php": "^7.1",
"jean85/pretty-package-versions": "^1.5",
"sentry/sdk": "^2.1",
"sentry/sdk": "^3.0",
"symfony/config": "^3.4||^4.0||^5.0",
"symfony/console": "^3.4||^4.0||^5.0",
"symfony/dependency-injection": "^3.4||^4.0||^5.0",
Expand All @@ -30,14 +30,14 @@
"symfony/security-core": "^3.4||^4.0||^5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.8",
"jangregor/phpstan-prophecy": "^0.6.2",
"monolog/monolog": "^1.11||^2.0",
"php-http/mock-client": "^1.0",
"friendsofphp/php-cs-fixer": "^2.16",
"jangregor/phpstan-prophecy": "^0.8",
"monolog/monolog": "^1.3||^2.0",
"php-http/mock-client": "^1.4",
"phpspec/prophecy": "!=1.11.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.19",
"phpstan/phpstan-phpunit": "^0.12.8",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.5||^8.5",
"symfony/browser-kit": "^3.4||^4.0||^5.0",
"symfony/expression-language": "^3.4||^4.0||^5.0",
Expand All @@ -49,7 +49,7 @@
"symfony/yaml": "^3.4||^4.0||^5.0"
},
"suggest": {
"monolog/monolog": "Required to use the Monolog handler"
"monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler."
},
"autoload": {
"psr-4": {
Expand All @@ -62,13 +62,19 @@
}
},
"scripts": {
"phpstan": "vendor/bin/phpstan analyse",
"cs-check": "vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run",
"cs-fix": "vendor/bin/php-cs-fixer fix --ansi --verbose"
"tests": [
"vendor/bin/phpunit --verbose"
],
"phpcs": [
"vendor/bin/php-cs-fixer fix --verbose --diff --dry-run"
],
"phpstan": [
"vendor/bin/phpstan analyse"
]
},
"extra": {
"branch-alias": {
"master": "4.x-dev",
"dev-master": "4.x-dev",
"releases/3.2.x": "3.2.x-dev",
"releases/2.x": "2.x-dev",
"releases/1.x": "1.x-dev"
Expand Down
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ parameters:
message: "#^Comparison operation \"\\>\\=\" between \\d+ and 40300 is always true\\.$#"
count: 1
path: test/End2End/App/Kernel.php

-
message: "#^Class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Client not found\\.$#"
count: 1
Expand Down Expand Up @@ -300,11 +299,6 @@ parameters:
count: 1
path: test/EventListener/RequestListenerTest.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Test\\\\EventListener\\\\RequestListenerTest\\:\\:getUserContext\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: test/EventListener/RequestListenerTest.php

-
message: "#^Method Sentry\\\\SentryBundle\\\\Test\\\\EventListener\\\\RequestListenerTest\\:\\:getTagsContext\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
11 changes: 7 additions & 4 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public function getConfigTreeBuilder(): TreeBuilder
'%kernel.project_dir%/vendor',
])
->prototype('scalar');
$optionsChildNodes->arrayNode('excluded_exceptions')
->defaultValue([])
->prototype('scalar');
$optionsChildNodes->scalarNode('http_proxy');
$optionsChildNodes->arrayNode('integrations')
->prototype('scalar')
Expand Down Expand Up @@ -109,7 +106,6 @@ public function getConfigTreeBuilder(): TreeBuilder
$optionsChildNodes->arrayNode('prefixes')
->defaultValue($defaultValues->getPrefixes())
->prototype('scalar');
$optionsChildNodes->scalarNode('project_root');

$releaseNode = $optionsChildNodes->scalarNode('release')
->info('Release version to be reported to sentry, see https://docs.sentry.io/workflow/releases/?platform=php')
Expand All @@ -126,6 +122,13 @@ public function getConfigTreeBuilder(): TreeBuilder
$optionsChildNodes->arrayNode('tags')
->normalizeKeys(false)
->prototype('scalar');
$optionsChildNodes->scalarNode('traces_sampler')
->validate()
->ifTrue($this->isNotAValidCallback())
->thenInvalid('Expecting callable or service reference, got %s');
$optionsChildNodes->floatNode('traces_sample_rate')
->min(0.0)
->max(1.0);

// Bundle-specific configuration
$listenerPriorities = $rootNode->children()
Expand Down
6 changes: 3 additions & 3 deletions src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ private function passConfigurationToOptions(ContainerBuilder $container, array $
'max_breadcrumbs',
'max_value_length',
'prefixes',
'project_root',
'release',
'sample_rate',
'send_attempts',
'send_default_pii',
'server_name',
'tags',
'traces_sample_rate',
'traces_sampler',
];

foreach ($mappableOptions as $optionName) {
Expand Down Expand Up @@ -130,9 +131,8 @@ private function passConfigurationToOptions(ContainerBuilder $container, array $
}

// we ignore fatal errors wrapped by Symfony because they produce double event reporting
$processedOptions['excluded_exceptions'][] = FatalError::class;
$ignoreOptions = [
'ignore_exceptions' => $processedOptions['excluded_exceptions'],
'ignore_exceptions' => [FatalError::class],
];

$integrations[] = new Definition(IgnoreErrorsIntegration::class, [$ignoreOptions]);
Expand Down
3 changes: 1 addition & 2 deletions src/EventListener/MessengerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Sentry\SentryBundle\EventListener;

use Sentry\FlushableClientInterface;
use Sentry\State\HubInterface;
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent;
Expand Down Expand Up @@ -66,7 +65,7 @@ public function onWorkerMessageHandled(WorkerMessageHandledEvent $event): void
private function flush(): void
{
$client = $this->hub->getClient();
if ($client instanceof FlushableClientInterface) {
if (null !== $client) {
$client->flush();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/RequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function onKernelRequest(RequestListenerRequestEvent $event): void

SentrySdk::getCurrentHub()
->configureScope(function (Scope $scope) use ($userData): void {
$scope->setUser($userData, true);
$scope->setUser($userData);
});
}

Expand Down
Loading