flownative/sentry
composer require flownative/sentry
A Sentry integration for Neos Flow
v1.3.1
- Requires
- ext-json: *
- php: ^7.4 || ^8.0
- neos/flow: ^6.3 || ^7.0 || ^8.0 || ^9.0 || @dev
- sentry/sdk: ^3.0
- jenssegers/agent: ^2.6
Sentry integration for Flow 6.x and Flow 7.x
This Flow package allows you to automate reporting of errors to Sentry
Key Features
Installation
The Sentry integration is installed as a regular Flow package via
Composer. For your existing project, simply include flownative/sentry
into the dependencies of your Flow or Neos distribution:
$ composer require flownative/sentry
Configuration
You need to at least specify a DSN to be used as a logging target. Apart from that, you can configure the Sentry environment and release. All options can either be set in the Flow settings or, more conveniently, by setting the respective environment variables.
Flownative:
Sentry:
dsn: "%env:SENTRY_DSN%"
environment: "%env:SENTRY_ENVIRONMENT%"
release: "%env:SENTRY_RELEASE%"
Throwables (that includes exceptions and runtime errors) are logged as Sentry events. You may specify a list of exceptions which should not be recorded. If such an exception is thrown, it will only be logged as a "notice".
Flownative:
Sentry:
capture:
excludeExceptionTypes:
- 'Neos\Flow\Mvc\Controller\Exception\InvalidControllerException'
If an ignored exception is handled by this Sentry client, it is logged similar to the following message:
… NOTICE Exception 12345: The exception message (Ref: 202004161706040c28ae | Sentry: ignored)
Testing the Client
This package provides a command controller which allows you to log a test message and a test exception.
Run the following command in your terminal to test your configuration:
./flow sentry:test
Testing Sentry setup …
Using the following configuration:
+-------------+------------------------------------------------------------+
| Option | Value |
+-------------+------------------------------------------------------------+
| DSN | https://abc123456789abcdef1234567890ab@sentry.io/1234567 |
| Environment | development |
| Release | dev |
| Server Name | test_container |
| Sample Rate | 1 |
+-------------+------------------------------------------------------------+
An informational message was sent to Sentry Event ID: #587abc123457abcd8f873b4212345678
This command will now throw an exception for testing purposes.
Test exception in SentryCommandController
Type: Flownative\Sentry\Exception\SentryClientTestException
Code: 1614759519
File: Data/Temporary/Development/SubContextBeach/SubContextInstance/Cache/Code/Fl
ow_Object_Classes/Flownative_Sentry_Command_SentryCommandController.php
Line: 79
Nested exception:
Test "previous" exception thrown by the SentryCommandController
Type: RuntimeException
Code: 1614759554
File: Data/Temporary/Development/SubContextBeach/SubContextInstance/Cache/Code/Fl
ow_Object_Classes/Flownative_Sentry_Command_SentryCommandController.php
Line: 78
Open Data/Logs/Exceptions/2021030308325919ecbf.txt for a full stack trace.