Giter Club home page Giter Club logo

nxsspryker-sentry's Introduction

NxsSpryker/Sentry

Spryker module to add Sentry as error monitoring.

Installation

composer require nxsspryker/sentry

For PHP Tracking you need to register the handler in the NxsErrorHandlerDependencyProvider.

<?php

namespace Pyz\Service\NxsErrorHandler;

use NxsSpryker\Service\NxsErrorHandler\NxsErrorHandlerDependencyProvider as NxsSpyNxsErrorHandlerDependencyProvider;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ErrorHandler;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ExceptionHandler;
use NxsSpryker\Service\Sentry\Business\Model\Handler\ShutdownHandler;

class NxsErrorHandlerDependencyProvider extends NxsSpyNxsErrorHandlerDependencyProvider
{
    /**
     * @return array
     */
    protected function getErrorHandlerPlugins(): array
    {
        return [
            new ErrorHandler()
        ];
    }

    /**
     * @return array
     */
    protected function getExceptionHandlerPlugins(): array
    {
        return [
            new ExceptionHandler()
        ];
    }

    /**
     * @return array
     */
    protected function getShutdownHandlerPlugins(): array
    {
        return [
            new ShutdownHandler()
        ];
    }

}

For JS Tracking you must activate the widget in your ShopApplicationDependencyProvider

<?php

namespace Pyz\Yves\ShopApplication;

use NxsSpryker\Yves\SentryWidget\Plugin\Provider\SentryWidgetPlugin;
use SprykerShop\Yves\ShopApplication\ShopApplicationDependencyProvider as SprykerShopApplicationDependencyProvider;

class ShopApplicationDependencyProvider extends SprykerShopApplicationDependencyProvider
{
 /**
  * @return string[]
  */
 protected function getGlobalWidgetPlugins(): array
 {
     return [
         // ...
         SentryWidgetPlugin::class
     ];
 }
}

Also you have to add the widget in your template:

{{ widgetGlobal('SentryWidgetPlugin') }}

Configuration

You can extend the client with an own plugin which implemements \NxsSpryker\Yves\Sentry\Dependency\Plugin\SentryClientPluginInterface. You can add them to the SentryDependencyProvider.

Also you have to add "NxsSpryker" as a project namespace in your config_default.php.

You have to configure an Sentry-Project for PHP in your configs:

use NxsSpryker\Service\Sentry\SentryConfig;

$config[SentryConfig::URL_KEY] = 'abc';
$config[SentryConfig::URL_DOMAIN] = 'sentry.io';
$config[SentryConfig::URL_PROJECT] = 'myproject';

$config[SentryConfig::IS_ACTIVE] = true;
$config[SentryConfig::CLIENT_URL] = sprintf(
    'https://%s@%s/%s',
    $config[SentryConfig::URL_KEY],
    $config[SentryConfig::URL_DOMAIN],
    $config[SentryConfig::URL_PROJECT]
);

You have to configure an Sentry-Project for JS in your configs:

use NxsSpryker\Yves\SentryWidget\SentryWidgetConfig;

$config[SentryWidgetConfig::URL_KEY] = 'abc';
$config[SentryWidgetConfig::URL_DOMAIN] = 'sentry.io';
$config[SentryWidgetConfig::URL_PROJECT] = 'myproject';

$config[SentryWidgetConfig::JS_IS_ACTIVE] = true;
$config[SentryWidgetConfig::JS_CLIENT_URL] = sprintf(
    'https://%s@%s/%s',
    $config[SentryWidgetConfig::URL_KEY],
    $config[SentryWidgetConfig::URL_DOMAIN],
    $config[SentryWidgetConfig::URL_PROJECT]
);

nxsspryker-sentry's People

Contributors

mibexx avatar patrickjaja avatar

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.