Skip to content

Spryker Module that streamlines the integration of sentry.io into your project

License

Notifications You must be signed in to change notification settings

turbine-kreuzberg/spryker-sentry

Repository files navigation

Spryker Sentry

About the package

This package enables Sentry.io to work with your Spryker shop by extending the Monitoring Module of Spryker and adding other hooks to here and there to enhance the data in Sentry.

Features

Installation

Composer

To get the latest version, simply require the package using Composer:

composer require turbine-kreuzberg/spryker-sentry

Configuration

Add the TurbineKreuzberg namespace to the PROJECT_NAMESPACES in your config/Shared/config_default.php file and configure the Sentry DSN:

$config[KernelConstants::PROJECT_NAMESPACES] = [
    'TurbineKreuzberg',
    // ...
];

$config[\TurbineKreuzberg\Shared\Sentry\SentryConstants::DSN] = '<your sentry DSN>';

Add the SentryMonitoringExtensionPlugin to Pyz\Service\Monitoring\MonitoringDependencyProvider:

<?php

namespace Pyz\Service\Monitoring;

use Spryker\Service\Monitoring\MonitoringDependencyProvider as SprykerMonitoringDependencyProvider;
use TurbineKreuzberg\Service\Sentry\Plugin\Monitoring\SentryMonitoringExtensionPlugin;

class MonitoringDependencyProvider extends SprykerMonitoringDependencyProvider
{
    protected function getMonitoringExtensions(): array
    {
        return [
            // ...
            new SentryMonitoringExtensionPlugin(),
            // ...
        ];
    }
}

Additional Configurations

You can adjust some configurations on the sentry module by adding some of this lines to your config file (ex. config_default.php):

// You can ignore certain exceptions by adding them to this array
$config[SentryConstants::IGNORED_EXCEPTIONS] = [
    ErrorException::class, // Example
];

// You can set your application version so that it gets reported to sentry
$config[SentryConstants::APPLICATION_VERSION] = '1.0.0';

// You can even get it from an env variable
$config[SentryConstants::APPLICATION_VERSION] = getenv('MY_APP_VERSION');

// You can set the percentage of your requests that are going to be traced for
// performance monitoring, value goes from 0 to 1, being 0.2 = 20%
$config[SentryConstants::TRACE_SAMPLE_RATE] = 0.4;

// You can define custom serializers for complex objects like transfer objects
// This will greatly enrich Sentry issues, making it possible to inspect object internal states across the backtrace
// Note that you can use instances of classes that implement the __invoke method instead of a closure
$config[SentryConstants::CLASS_SERIALIZERS] = [
    Spryker\Shared\Kernel\Transfer\AbstractTransfer => function(Spryker\Shared\Kernel\Transfer\AbstractTransfer $data) {
        return $data->toArray();
    }
];

About

Spryker Module that streamlines the integration of sentry.io into your project

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages