Skip to content
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

use when@prod for sentry #1419

Closed

Conversation

robinlehrmann
Copy link
Contributor

Q A
License MIT

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 11, 2022 00:08
@github-actions
Copy link

github-actions bot commented Jul 11, 2022

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1419/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes-contrib/flex/pull-1419/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'sentry/sentry-symfony:^4.0'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes.
I'm going keep this comment up to date with any updates of the attached patch.

sentry/sentry-symfony

1.0 vs 3.0
diff --git a/sentry/sentry-symfony/1.0/config/packages/prod/sentry.yaml b/sentry/sentry-symfony/1.0/config/packages/prod/sentry.yaml
deleted file mode 100644
index 342036fe..00000000
--- a/sentry/sentry-symfony/1.0/config/packages/prod/sentry.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-sentry:
-    dsn: '%env(SENTRY_DSN)%'
diff --git a/sentry/sentry-symfony/1.0/config/packages/sentry.yaml b/sentry/sentry-symfony/3.0/config/packages/sentry.yaml
index e94da2d6..f8f4ca51 100644
--- a/sentry/sentry-symfony/1.0/config/packages/sentry.yaml
+++ b/sentry/sentry-symfony/3.0/config/packages/sentry.yaml
@@ -1,8 +1,24 @@
-sentry:
-    options:
-        curl_method: async
+when@prod:
+    sentry:
+        dsn: '%env(SENTRY_DSN)%'
+        options:
+            excluded_exceptions:
+                - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+                - Symfony\Component\Security\Core\Exception\AccessDeniedException
 
-#    skip_capture:  # To skip certain exceptions, specify a list below
-#      - 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'
-#      - 'Symfony\Component\HttpKernel\Exception\BadRequestHttpException'
-#      - 'Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException'
+#       If you are using Monolog, you also need these additional configuration and services to log the errors correctly:
+#       https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration
+#       register_error_listener: false
+
+#        monolog:
+#            handlers:
+#                sentry:
+#                    type: service
+#                    id: Sentry\Monolog\Handler
+
+#        services:
+#            Sentry\Monolog\Handler:
+#                arguments:
+#                    $hub: '@Sentry\State\HubInterface'
+#                    $level: !php/const Monolog\Logger::ERROR
+#                    $bubble: false
diff --git a/sentry/sentry-symfony/1.0/manifest.json b/sentry/sentry-symfony/3.0/manifest.json
index c96ec90e..097e7e84 100644
--- a/sentry/sentry-symfony/1.0/manifest.json
+++ b/sentry/sentry-symfony/3.0/manifest.json
@@ -1,6 +1,6 @@
 {
     "bundles": {
-        "Sentry\\SentryBundle\\SentryBundle": ["all"]
+        "Sentry\\SentryBundle\\SentryBundle": ["prod"]
     },
     "copy-from-recipe": {
         "config/": "%CONFIG_DIR%/"
3.0 vs 4.0
diff --git a/sentry/sentry-symfony/3.0/config/packages/sentry.yaml b/sentry/sentry-symfony/4.0/config/packages/sentry.yaml
index f8f4ca51..7b657897 100644
--- a/sentry/sentry-symfony/3.0/config/packages/sentry.yaml
+++ b/sentry/sentry-symfony/4.0/config/packages/sentry.yaml
@@ -1,10 +1,6 @@
 when@prod:
     sentry:
         dsn: '%env(SENTRY_DSN)%'
-        options:
-            excluded_exceptions:
-                - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
-                - Symfony\Component\Security\Core\Exception\AccessDeniedException
 
 #       If you are using Monolog, you also need these additional configuration and services to log the errors correctly:
 #       https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration
diff --git a/sentry/sentry-symfony/3.0/manifest.json b/sentry/sentry-symfony/4.0/manifest.json
index 097e7e84..9e07f9cc 100644
--- a/sentry/sentry-symfony/3.0/manifest.json
+++ b/sentry/sentry-symfony/4.0/manifest.json
@@ -7,5 +7,8 @@
     },
     "env": {
         "SENTRY_DSN": ""
+    },
+    "conflict": {
+        "symfony/framework-bundle": "<5.4"
     }
 }

auto-merge was automatically disabled July 11, 2022 00:13

Head branch was pushed to by a user without write access

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 11, 2022 00:13
auto-merge was automatically disabled July 11, 2022 00:19

Head branch was pushed to by a user without write access

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 11, 2022 00:20
@nicolas-grekas
Copy link
Member

The recipe is missing a "conflict" rule with framework-bundle < 5.4.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

please ensure that the indentation is always 4 spaces in all examples (with no leading space for the first line of yaml)

sentry/sentry-symfony/3.0/config/packages/sentry.yaml Outdated Show resolved Hide resolved
sentry/sentry-symfony/3.0/config/packages/sentry.yaml Outdated Show resolved Hide resolved
sentry/sentry-symfony/3.0/config/packages/sentry.yaml Outdated Show resolved Hide resolved
auto-merge was automatically disabled July 11, 2022 09:56

Head branch was pushed to by a user without write access

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 11, 2022 09:56
@robinlehrmann
Copy link
Contributor Author

Thanks for the review @nicolas-grekas
I fixed what you mentioned and hope that everything is correct now. If not, feel free to tell me. :)

* use when@prod
* added sentry version 4.0
* use correct spaces
* added conflict with symfony/framework-bundle <5.3
auto-merge was automatically disabled July 11, 2022 10:16

Head branch was pushed to by a user without write access

@symfony-recipes-bot symfony-recipes-bot enabled auto-merge (squash) July 11, 2022 10:16
@nicolas-grekas
Copy link
Member

The change on 3.0 looks wrong isn't it? I submitted #1420 with what looks like the correct patch to me. WDYT?

@robinlehrmann
Copy link
Contributor Author

The change on 3.0 looks wrong isn't it? I submitted #1420 with what looks like the correct patch to me. WDYT?

Oh.. you are right 😅 yes, looks good :)

auto-merge was automatically disabled July 12, 2022 09:17

Pull request was closed

@robinlehrmann robinlehrmann deleted the moved-sentry-config branch July 12, 2022 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants