GithubHelp home page GithubHelp logo

sentry-flow's Introduction

Latest Stable Version Total Downloads License

This is a Sentry client package for the Flow framework.

Have a look at https://sentry.io for more information about Sentry.

Installation

$ composer require punktde/sentry-flow

Compatibilty matrix

Flow Sentry Client Flow Sentry SDK Sentry Server
^1.0 ^4.0 ^1.0 *
^2.0 ^5.0 ^1.0 *
^3.0 ^5.0, ^6.0 ^2.0 *
^4.0 ^5.0, ^6.0, ^7.0 ^3.0 >= v20.6.0

Configuration

Add the following to your Settings.yaml and replace the dsn setting with your project DSN (API Keys in your Sentry project):

PunktDe:
  Sentry:
    Flow:
      dsn: 'https://[email protected]/project-id'

You can also set the Sentry Environment to filter your exceptions by e.g. dev-/staging-/live-system. Set the env variable SENTRY_ENVIRONMENT or add your value to your Settings.yaml:

PunktDe:
  Sentry:
    Flow:
      environment: 'live'

Furthermore you can set the Sentry Release version to help to identifiy with which release an error occurred the first time. By default, a file which is starting with the name RELEASE_ is searched and the values after RELEASE_ is used for Sentry. Alternatively you can override the filebased release number and set an environment variable SENTRY_RELEASE or add your value to your Settings.yaml:

PunktDe:
  Sentry:
    Flow:
      release: '5.0.3'

If you need to use a custom transport e.g. to write the sentry reports to a file, you must implement the Sentry\TransportInterface:

<?php
declare(strict_types=1);

namespace Vendor\Package\Sentry\Transport;

use Sentry\Event;
use Sentry\Exception\JsonException;
use Sentry\Transport\TransportInterface;
use Sentry\Util\JSON;

class FileWriterTransport implements TransportInterface
{
    /**
     * @param Event $event
     *
     * @return string|null Returns the ID of the event or `null` if it failed to be sent
     *
     * @throws JsonException
     */
    public function send(Event $event): ?string
    {
        if (file_put_contents('My\Path\And\FileName', JSON::encode($event)) !== false) {
            return $event->getId();
        }
        return null;
    }
}

Then you configure the class to be used:

PunktDe:
  Sentry:
    Flow:
      transportClass: '\Vendor\Package\Sentry\Transport\FileWriterTransport'

Usage

Sentry will log all exceptions that have the rendering option logException enabled. This can be enabled or disabled by status code or exception class according to the Flow configuration.

sentry-flow's People

Contributors

andrehoffmann30 avatar daniellienert avatar fnkr avatar kabarakh avatar sebobo avatar thedex avatar thelalaman avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sentry-flow's Issues

Make Sentry client option`send_default_pii` available via settings

We wanted to use the inbound filters on a Sentry cloud instance to filter by IP address and discovered that the package does not send the IP at all.

It would be helpful to be able to configure this via settings, the Sentry client needs the option send_default_pii set to true. Then the IP address is sent to the Sentry cloud instance and the filters work.

The option "environment" with value false is expected to be of type "null" or "string", but is of type "bool".

In

$this->environment = $settings['environment'] ?? '';
when the value in $settings['environment'] is false (e.g. when using env var substitution but no variable is defined), that is used and leads to The option "environment" with value false is expected to be of type "null" or "string", but is of type "bool".

This instead works:

$settings['environment'] ? $settings['environment'] : ''

(see https://3v4l.org/8j0bt)

Exception in line 895 of /…/Packages/Libraries/symfony/options-resolver/OptionsResolver.php: The option "environment" with value false is expected to be of type "null" or "string", but is of type "bool".

47 Symfony\Component\OptionsResolver\OptionsResolver::offsetGet()
46 Symfony\Component\OptionsResolver\OptionsResolver::resolve()
45 Sentry\Options::__construct()
44 Sentry\ClientBuilder::create()
43 PunktDe\Sentry\Flow\Handler\ErrorHandler_Original::initializeObject()
42 PunktDe\Sentry\Flow\Handler\ErrorHandler::__construct()
41 Neos\Flow\ObjectManagement\ObjectManager::instantiateClass()
40 Neos\Flow\ObjectManagement\ObjectManager::get()
39 PunktDe\Sentry\Neos\Aspect\FusionHandlerAspect::PunktDe\Sentry\Neos\Aspect\{closure}()
38 Closure::__invoke()
37 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::_activateDependency()
36 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call()
35 PunktDe\Sentry\Neos\Aspect\FusionHandlerAspect_Original::captureException()
…

Access to `before_send` hook of SDK to prevent special PII from being sent?

We would like to prevent sending special PII (personal identifiable information, like email addresses for example) to Sentry apart from the PII already configured by default.

The Sentry PHp SDK documentation states that a before_hook is available on initialization of the Sentry client (https://docs.sentry.io/platforms/php/configuration/filtering/#filtering-error-events), is there any way we can utilize this with this package?

Fatal error after composer update

Hello,

I just did a composer update from my Neos (7.3.5) project and I have this error from this package

PHP Fatal error: Uncaught Neos\Flow\Error\Exception: Warning: Declaration of PunktDe\Sentry\Flow\Handler\ExceptionHandlerTrait::echoExceptionCli(Throwable $exception): void should be compatible with Neos\Flow\Error\AbstractExceptionHandler::echoExceptionCli(Throwable $exception, bool $exceptionWasLogged) in /var/www/gabwebcms.alloboissons.ch/Packages/Application/PunktDe.Sentry.Flow/Classes/Handler/DebugExceptionHandler.php line 27 in /var/www/gabwebcms.alloboissons.ch/Packages/Framework/Neos.Flow/Classes/Error/ErrorHandler.php:81 Stack trace: #0 /var/www/gabwebcms.alloboissons.ch/Packages/Application/PunktDe.Sentry.Flow/Classes/Handler/DebugExceptionHandler.php(13): Neos\Flow\Error\ErrorHandler->handleError() #1 /var/www/gabwebcms.alloboissons.ch/Packages/Libraries/composer/ClassLoader.php(571): include('/var/www/gabweb...') #2 /var/www/gabwebcms.alloboissons.ch/Packages/Libraries/composer/ClassLoader.php(428): Composer\Autoload\includeFile() #3 [internal function]: Composer\Autoload\ClassLoader->loadClass() #4 [internal func in /var/www/gabwebcms.alloboissons.ch/Packages/Framework/Neos.Flow/Classes/Error/ErrorHandler.php on line 81

There is the package list updated, maybe it can help

  • Upgrading composer/composer (2.3.5 => 2.3.7)
  • Upgrading flowpack/elasticsearch (5.0.4 => 5.0.5)
  • Upgrading laminas/laminas-code (4.5.1 => 4.5.2)
  • Upgrading neos/cache (7.3.5 => 7.3.6)
  • Upgrading neos/eel (7.3.5 => 7.3.6)
  • Upgrading neos/error-messages (7.3.5 => 7.3.6)
  • Upgrading neos/flow (7.3.5 => 7.3.6)
  • Upgrading neos/flow-log (7.3.5 => 7.3.6)
  • Upgrading neos/fluid-adaptor (7.3.5 => 7.3.6)
  • Upgrading neos/http-factories (7.3.5 => 7.3.6)
  • Upgrading neos/kickstarter (7.3.5 => 7.3.6)
  • Upgrading neos/utility-arrays (7.3.5 => 7.3.6)
  • Upgrading neos/utility-files (7.3.5 => 7.3.6)
  • Upgrading neos/utility-mediatypes (7.3.5 => 7.3.6)
  • Upgrading neos/utility-objecthandling (7.3.5 => 7.3.6)
  • Upgrading neos/utility-opcodecache (7.3.5 => 7.3.6)
  • Upgrading neos/utility-pdo (7.3.5 => 7.3.6)
  • Upgrading neos/utility-schema (7.3.5 => 7.3.6)
  • Upgrading neos/utility-unicode (7.3.5 => 7.3.6)
  • Upgrading nikic/php-parser (v4.13.2 => v4.14.0)
  • Upgrading symfony/polyfill-ctype (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-iconv (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-intl-grapheme (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-intl-idn (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-intl-normalizer (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-php80 (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-php81 (v1.25.0 => v1.26.0)
  • Upgrading symfony/polyfill-uuid (v1.25.0 => v1.26.0)
  • Upgrading webmozart/assert (1.10.0 => 1.11.0)

Thanks a lot for your time and if I can help, don't hesitate !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.