涡轮-克劳泽伯格 / 斯普瑞克哨兵
使用此包/SDK轻松在您的斯普瑞克商店中启用 Sentry.io
0.1.2
2022-11-28 09:00 UTC
Requires
- php: >=7.3
- sentry/sdk: ^3.1
- spryker/kernel: ^3
- spryker/monitoring: ^2
Requires (Dev)
- codeception/module-asserts: ^1.3
- fond-of-codeception/spryker: ^1.2
- spryker/code-sniffer: ^0.16.0
- spryker/container: *
- spryker/testify: *
This package is auto-updated.
Last update: 2024-09-15 10:48:17 UTC
README
关于此包
此包通过扩展斯普瑞克的监控模块并在各处添加其他挂钩以增强Sentry中的数据,使Sentry.io能够与您的斯普瑞克商店一起工作。
功能
- 将Sentry.io与斯普瑞克监控模块集成
- 可以通过配置键忽略某些异常
安装
Composer
要获取最新版本,只需使用Composer要求此包即可
composer require turbine-kreuzberg/spryker-sentry
配置
将TurbineKreuzberg
命名空间添加到config/Shared/config_default.php
文件中的PROJECT_NAMESPACES
,并配置Sentry DSN
$config[KernelConstants::PROJECT_NAMESPACES] = [ 'TurbineKreuzberg', // ... ]; $config[\TurbineKreuzberg\Shared\Sentry\SentryConstants::DSN] = '<your sentry DSN>';
将SentryMonitoringExtensionPlugin
添加到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(), // ... ]; } }
其他配置
您可以通过在配置文件(例如config_default.php)中添加一些行来调整sentry模块的一些配置
// 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(); } ];