Giter VIP home page Giter VIP logo

yii2-sentry's Introduction

Sentry logger for Yii2

Build Status Latest Stable Version Total Downloads License

Installation

composer require notamedia/yii2-sentry

Add target class in the application config:

return [
    'components' => [
	    'log' => [
		    'traceLevel' => YII_DEBUG ? 3 : 0,
		    'targets' => [
			    [
				    'class' => 'notamedia\sentry\SentryTarget',
				    'dsn' => 'http://2682ybvhbs347:[email protected]/1',
				    'levels' => ['error', 'warning'],
				    // Write the context information (the default is true):
				    'context' => true,
				    // Additional options for `Sentry\init`:
				    'clientOptions' => ['release' => '[email protected]']
			    ],
		    ],
	    ],
    ],
];

Usage

Writing simple message:

\Yii::error('message', 'category');

Writing messages with extra data:

\Yii::warning([
    'msg' => 'message',
    'extra' => 'value',
], 'category');

Extra callback

extraCallback property can modify extra's data as callable function:

    'targets' => [
        [
            'class' => 'notamedia\sentry\SentryTarget',
            'dsn' => 'http://2682ybvhbs347:[email protected]/1',
            'levels' => ['error', 'warning'],
            'context' => true, // Write the context information. The default is true.
            'extraCallback' => function ($message, $extra) {
                // some manipulation with data
                $extra['some_data'] = \Yii::$app->someComponent->someMethod();
                return $extra;
            }
        ],
    ],

Tags

Writing messages with additional tags. If need to add additional tags for event, add tags key in message. Tags are various key/value pairs that get assigned to an event, and can later be used as a breakdown or quick access to finding related events.

Example:

\Yii::warning([
    'msg' => 'message',
    'extra' => 'value',
    'tags' => [
        'extraTagKey' => 'extraTagValue',
    ]
], 'category');

More about tags see https://docs.sentry.io/learn/context/#tagging-events

Additional context

You can add additional context (such as user information, fingerprint, etc) by calling \Sentry\configureScope() before logging. For example in main configuration on beforeAction event (real place will dependant on your project):

return [
    // ...
    'on beforeAction' => function (\yii\base\ActionEvent $event) {
        /** @var \yii\web\User $user */
        $user = Yii::$app->has('user', true) ? Yii::$app->get('user', false) : null;
        if ($user && ($identity = $user->getIdentity(false))) {
            \Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($identity) {
                $scope->setUser([
                    // User ID and IP will be added by logger automatically
                    'username' => $identity->username,
                    'email' => $identity->email,
                ]);
            });
        }
    
        return $event->isValid;
    },
    // ...
];

Log levels

Yii2 log levels converts to Sentry levels:

\yii\log\Logger::LEVEL_ERROR => 'error',
\yii\log\Logger::LEVEL_WARNING => 'warning',
\yii\log\Logger::LEVEL_INFO => 'info',
\yii\log\Logger::LEVEL_TRACE => 'debug',
\yii\log\Logger::LEVEL_PROFILE_BEGIN => 'debug',
\yii\log\Logger::LEVEL_PROFILE_END => 'debug',

yii2-sentry's People

Contributors

cookieseater avatar dawidrylko avatar dmhaiduchonak avatar i-sevostyanov avatar julian-b90 avatar mitrm avatar niksamokhvalov avatar nixmen avatar orionchikby avatar perfectio avatar shmakov avatar silverfire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-sentry's Issues

Probable bug in passing extra data while processing an exception

I think there is a bug in passing extra data while processing an exception

vendor/notamedia/yii2-sentry/src/SentryTarget.php:76

if ($text instanceof \Throwable || $text instanceof \Exception) {
                $data = $this->runExtraCallback($text, $data);
                \Sentry\captureException($text, $data);
                continue;
            } 

there \Sentry\captureException($text, $data); we pass two arguments to function captureException. But function accept only one.

/**
 * Captures an exception event and sends it to Sentry.
 *
 * @param \Throwable $exception The exception
 */
function captureException(\Throwable $exception): ?string
{
    return SentrySdk::getCurrentHub()->captureException($exception);
}

So second argument with extra data, provided by extraCallback is just ignored.

How collect js error?

Hi,
How to collect error javascript? I use old yii2-sentry with sdk 1. I would like to update, but js errors needs.
Any ideas how use you module and add js errors?

problems with ip permissions errors

Hi, I went back and looked your suggestion (#10) ... the example I gave you had an extra ] closing the components array. I am still getting this error all the time when search engines / scanners hit api.meetingplanner.io

https://screencast.com/t/oxpdAwhpssJn

return [ 'id' => 'app-api', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'api\controllers', 'bootstrap' => ['log'], 'components' => [ 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'notamedia\sentry\SentryTarget', 'dsn' => 'http://'.$config['sentry_key_public'].':'.$config['sentry_key_private'].'@sentry.io/'.$config['sentry_id'], 'levels' => ['error', 'warning'], 'context' => true, // Write the context information. The default is true. ], ], ], 'errorHandler' => [ 'errorAction' => 'service/error', ], ...

Unusable stack trace (crashed in non-app)

Hi there,

I tried to configure sentry for yii2 project in our company, here is the configuration used

"notamedia/yii2-sentry": "dev-master",
[
    'class' => 'notamedia\sentry\SentryTarget',
     'dsn' => env('SENTRY_DSN'),
    'context' => true,
    'clientOptions' => [
        'environment' => env('SENTRY_ENV'),
        'attach_stacktrace' => true
    ],
    'logVars' => [],
    'levels' => ['error'],
    'except' => ['yii\web\Session*', 'yii\db\Command*', 'yii\db\Connection\*', 'yii\filters\*', 'yii\db\Exception', 'yii\base\ErrorException*','yii\web\HttpException:404','yii\web\HttpException:400'],
],

However the resulting stack trace are only displaying result from this package and Yii Logger
Screen Shot 2022-03-30 at 16 28 13
Screen Shot 2022-03-30 at 16 29 55

Can you help with correct setup to have usable stack trace?

Silently die on PHP < 7.2

On PHP < 7.2 it silently die without any error message.
Probably caused by Sentry SDK that require PHP 7.2.

Is any error message possible in such a case?
Not urgent, but may save some time to other developpers facing the similar situation like me (apache PHP 8.0, shell PHP 7.1).

Thank you :-)

Sentry receiving two API Calls from Logger

Hi,

i am using your library (thanks!) in yii2 and my sentry is receiving always two POST requests (and Events in Sentry) from my application.

10.42.2.0 - - [09/Jul/2020:12:22:00 +0000] "POST /api/2/store/ HTTP/1.1" 200 366 "-" "sentry.php/2.3.2"
10.42.2.0 - - [09/Jul/2020:12:22:00 +0000] "POST /api/2/store/ HTTP/1.1" 200 366 "-" "sentry.php/2.3.2"

my config is very basic:

    $config['components']['log']['targets'][] = [
        'class' => 'notamedia\sentry\SentryTarget',
        'dsn' => 'https://***@***/2',
        'levels' => ['error', 'warning'],
        'except' => ['yii\web\HttpException:401'],
        'context' => true,
        'extraCallback' => function($message, $extra) {
            $extra['request_id'] = \Yii::$app->requestId->get();
            return $extra;
        }
    ];

one event has all the extra infos in it like user, ip... and the other one is very basic. i am confused :)

could you reproduce this problem?

thanks!
Rainer

Add ip address

Hi, if you could add the ability to include the user's ip address, that would be helpful. I'm not very good with git but this is how I was able to get it working for me. In SentryTarget I added this function:

function getUserIpAddr(){
	if(!empty($_SERVER['HTTP_CLIENT_IP'])){
		//ip from share internet
		$ip = $_SERVER['HTTP_CLIENT_IP'];
	}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
		//ip pass from proxy
		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
	}else{
		$ip = $_SERVER['REMOTE_ADDR'];
	}
	return $ip;
}

Then I added this piece of code in the export function just after the $data array near the top:

        $userIp = $this->getUserIpAddr();
		if (!empty($userIp)) {
			\Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($data, $userIp): void {
				$scope->setUser(['ip' => $userIp]);
			});
		}

Troubles with installing through Composer

I'm trying to install this plugin with composer and it isn't installing at all. There's some error with composer/package-versions-deprecated

I've tried:
— composer clearcache
— remove vendor and install everything again from scratch

But the error is still there.

Composer version 1.10.10 2020-08-03 11:35:19
PHP 7.4.4
CentOS Linux release 7.7.1908 (Core)

Composer installation log:

 > composer require notamedia/yii2-sentry
Using version ^1.5 for notamedia/yii2-sentry
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 8 installs, 0 updates, 0 removals
  - Installing composer/package-versions-deprecated (1.10.99): Downloading (100%)         
Plugin installation failed (include(/var/www/creatium/vendor/composer/package-versions-deprecated/src/PackageVersions/Installer.php): failed to open stream: No such file or directory), rolling back
  - Removing composer/package-versions-deprecated (1.10.99)

Installation failed, reverting ./composer.json to its original content.

                                                                                                       
  [RuntimeException]                                                                                   
  Could not delete /var/www/creatium/vendor/composer/package-versions-deprecated/src/PackageVersions:  
                                                                                                       

require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

No session in Sentry issues

Hello!

I've updated this plugin version from v1 to v2 and added clientOptions: release and environment. But Sentry doesn't receive my session variables now.

Here is Sentry target config:

[
                    'class' => SentryTarget::class,
                    'dsn' => 'DSN',
                    'levels' => ['error', 'warning'],
                    'except' => [
                        'yii\web\HttpException:400',
                        'yii\web\HttpException:403',
                        'yii\web\HttpException:404',
                    ],
                    'clientOptions' => [
                        'release' => 'version tag',
                        'environment' => 'prod',
                    ],
                    'context' => true,
                ]

My session is stored in redis (but this is working about a couple of years):

'session' => [
            'class' => Session::class,
            'redis' => 'redis',
            'timeout' => 86400,
        ],

Due to this issue I can't recognize users in Sentry. What could be wrong?

sentry-php package really required?

Hello!
I've seen in composer.json that sentry/sentry is required for this project, I haven't seen it used though. I just wondering why is the package required.

Thanks!

except doesn't work for SentryTarget configuration

This is my log configuration:

                'sentry' => [
                    'class' => SentryTarget::class,
                    'dsn' => env('SENTRY_DSN'),
                    'levels' => ['error', 'warning'],
                    'except' => [
                        'yii\web\HttpException:40*'
                    ],
                    'enabled' => !empty(env('SENTRY_DSN')),
                ],

But I'm still getting 404 error in sentry log.
I checked the same syntax in other Log targets end it works.
Can you help me to find out what is wrong or fix the problem?

Is sentry-trace header supported?

Hello.
I'm trying to use distributed tracing with frontend (js vue) and backend (php yii2).
It's looks like sentry-trace header is not recognized.

Performace Monitoring Issue

Hello, I have a Yii2 project using the advanced template, and have configured the Sentry logs as follow:

'log' => [
    ...
    [
        // Sentry logging
        'class' => \notamedia\sentry\SentryTarget::class,
        'dsn' => <SENTRY_DSN>,
        'levels' => ['error', 'warning'],
        'clientOptions' => [
            //'traces_sample_rate' => 1.0,
            'traces_sampler' =>  static function (\Sentry\Tracing\SamplingContext $context): float {
                // Test sample rate for all transactions
                return 1.0;
            }
        ],
    ]
    ...
]

The piece of code above is located at the <source_directory>/common/config/main.php file and it is being properly loaded in the project. For the matter of testing I have returned return 1.0 for all the cases.

No with that configuration, I'm able to get proper logs of the exceptions occurring on the system, but I'm not getting anything in the Performance menu. Perhaps I'm doing something wrong?

I would like to see what is described here https://docs.sentry.io/platforms/php/#performance-monitoring

Thanks in advance!

Can't stop: Warning: Access to debugger is denied due to IP address restriction. The requesting IP address is

Hi,

On one of my sites Sentry plugin works great, but on this other site I keep getting this warning report: https://screencast.com/t/pW2jzG689

Frontend/web/index.php
`<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(DIR . '/../../vendor/autoload.php');
require(DIR . '/../../vendor/yiisoft/yii2/Yii.php');
require(DIR . '/../../common/config/bootstrap.php');
require(DIR . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
require(DIR . '/../../common/config/main.php'),
require(DIR . '/../../common/config/main-local.php'),
require(DIR . '/../config/main.php'),
require(DIR . '/../config/main-local.php')
);

$application = new yii\web\Application($config);
$application->run();
`

main.php, not sure how to configure this so sentry is live on production but debug is not

return [ 'id' => 'app-frontend', 'basePath' => dirname(__DIR__), 'bootstrap' => ['chiliec\vote\components\VoteBootstrap','log','\common\components\SiteHelper'], // 'debug' 'components' => [ 'assetManager' => [ 'appendTimestamp' => true, ], ], 'modules' => [ 'debug' => [ 'class' => 'yii\debug\Module', ],

'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'notamedia\sentry\SentryTarget', 'dsn' => 'http://'.$config['sentry_key_public']. ':'.$config['sentry_key_private']. '@sentry.io/'.$config['sentry_id'], 'levels' => ['error', 'warning'], 'context' => true, // Write the context information. The default is ], ], ],

Issues with extraCallback

Hello,

Thanks for your work on the extension.

I'm trying to use the extraCallback functionality of the extension and it doesn't seem to work. Doesn't matter what kind of changes I do to the $extra array under the extraCallback property, it doesn't modify the extra's data on the sentry side.

I think the issue could be the fact that in the case of $text being an instance of \Throwable the function stops its execution and the extraCallback is never being called.

Any help is appreciated. Thanks!

Out of Memory Exceptions (Fatal Errors) are not being send to sentry

Steps to reproduce.

  1. Configure extension
  2. add somewhere e.g in a view $a = str_repeat("Hello", 4242000000); (Memory exception)
  3. run the view

Environment

PHP: 7.4.9
Yii2: 2.0.37
notamedia/yii2-sentry: latest

Expected: New event in sentry

Behavior:

  • Nothing logged
  1. php-sentry tracked via xdebug is called and the exception should be sent
  2. if we change the handleFatalError() in base/ErrorHandler.php to not exit(1) the exception is logged

grafik

It feels that the errors are not logged because the proccess is ended before sending?

Ignore certain error classes

I want to ignore some error classes, like yii\web\NotFoundHttpException. How should I modify config?

'log'          => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets'    => [
                [
                    'class'   => 'notamedia\sentry\SentryTarget',
                    'dsn'     => 'https://...@.../3',
                    'levels'  => ['error', 'warning'],
                    // Write the context information (the default is true):
                    'context' => true,
                    // Additional options for `Sentry\init`:
                    //'clientOptions' => ['release' => '[email protected]']
                ],
            ] 
]

ALARM 1.5.1

PHP message: PHP Notice: Trying to get property 'enabled' of non-object in /vendor/yiisoft/yii2/log/Dispatcher.php on line 187

Event exclusion ("except" parameter) not working

When trying to use the except property to prevent specific exceptions to be logged, these are still sent to Sentry.

Yii: 2.0.36
Yii2-Sentry: 1.6.0b

Configuration:

'log' => [
            'targets' => [
                [
                    'class' => 'notamedia\sentry\SentryTarget',
                    'except' => [
                        'yii\web\HttpException:404',
                        'yii\web\NotFoundHttpException',
                        'yii\web\UnauthorizedHttpException'
                    ],
                    'dsn' => $params['sentry']['dsn'],
                    'levels' => $params['sentry']['levels'],
                    'context' => $params['sentry']['context']
                ]
            ]
        ],

According to the CHANGELOG it seems it was fixed in v1.5.1, am I missing something? 😊

Introduce a way to configure ClientBuilder

Hi. I want to use my custom HTTP client. According to the documentation, it should be done by calling ClientBuilder::setTransportFactory(). But it is not possible at the moment because it's created only on the target's constructor and there is no way to touch it before the Sentry client will be created.

Could not resolve package dependencies

Upd: can be solved by
php composer.phar global require "fxp/composer-asset-plugin:^1.3.1"

Cloned this project to my local machine via
git clone https://github.com/notamedia/yii2-sentry.git

When I tried to install composer dependencies get error:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.4 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.3 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.20 requires bower-asset/jquery 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.2 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
    - yiisoft/yii2 2.0.19 requires bower-asset/jquery 3.4.*@stable | 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.18 requires bower-asset/jquery 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.17 requires bower-asset/jquery 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.16.1 requires bower-asset/jquery 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.16 requires bower-asset/jquery 3.3.*@stable | 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.15.1 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.15 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.14.2 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.14.1 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.14 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.13.3 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.13.2 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.13.1 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.13 requires bower-asset/jquery 3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.12.2 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.12.1 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.12 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11.2 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11.1 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.11 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.10 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.1 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 ~2.0 -> satisfiable by yiisoft/yii2[2.0.0, 2.0.1, 2.0.10, 2.0.11, 2.0.11.1, 2.0.11.2, 2.0.12, 2.0.12.1, 2.0.12.2, 2.0.13, 2.0.13.1, 2.0.13.2, 2.0.13.3, 2.0.14, 2.0.14.1, 2.0.14.2, 2.0.15, 2.0.15.1, 2.0.16, 2.0.16.1, 2.0.17, 2.0.18, 2.0.19, 2.0.2, 2.0.20, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.```

Perfomance Transactions

Hello.
Can you provide example for Perfomance Transactions, please?
I had tried this, but it doesn't work:

'class'   => \notamedia\sentry\SentryTarget::class,
'dsn'     => SENTRY_DSN,
'levels'  => ['error', 'warning'],
// Write the context information (the default is true):
'context' => true,
// Additional options for `Sentry\init`:
'clientOptions' => [
	'traces_sample_rate' => (YII_DEBUG ? 1 : 0.1),
],
$transactionContext = new \Sentry\Tracing\TransactionContext();
$transactionContext->setName('Request Transaction');
$transactionContext->setOp('request');

// Start the transaction
$transaction = \Sentry\startTransaction($transactionContext);
'on beforeRequest' => function() use ($transaction) {
	// Set the current transaction as the current span so we can retrieve it later
	\Sentry\SentrySdk::getCurrentHub()->setSpan($transaction);
},
'on afterRequest' => function() use ($transaction) {
	// Set the current span back to the transaction since we just finished the previous span
	\Sentry\SentrySdk::getCurrentHub()->setSpan($transaction);

	// Finish the transaction, this submits the transaction and it's span to Sentry
	$transaction->finish();
}

Support composer without composer.lock

Hello

Thank you for this nice extension.

We are working in development without .lock file. If we try to install your extension the message

[LogicException]
No lockfile found. Unable to read locked packages

appears. I can create a lock file temporary but I think it should also work without.

Yii not reporting user informations

I just configured this plugin as follows :

'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning','info'],
                ],
                [
                    'class' => 'notamedia\sentry\SentryTarget',
                    'dsn' => 'http://<id>@<server-address>/4',
                    'levels' => ['error', 'warning'],
                    // Write the context information (the default is true):
                    'context' => true,
                    // Additional options for `Sentry\init`:
                    //'clientOptions' => ['release' => '[email protected]']
                    'on beforeAction' => function (\yii\base\ActionEvent $event) {
                        Yii::error("Test");
                        /** @var \yii\web\User $user */
                        $user = Yii::$app->has('user', true) ? Yii::$app->get('user', false) : null;
                        if ($user && ($identity = $user->getIdentity(true))) {
                            \Sentry\configureScope(function (\Sentry\State\Scope $scope) use ($identity) {
                                $scope->setUser([
                                    // User ID and IP will be added by logger automatically
                                    'username' => $identity->username,
                                    'email' => $identity->email,
                                ]);
                            });
                        }

                        return $event->isValid;
                    },
                ],
            ],
        ],

But unfortunately, only user's ID and IP are reported. Is there anything I've done wrong ? Thanks.

В senrty приходит 2 сообщения по одной ошибке

Настроила таким образом:

        'log' => [
            'targets' => [
                [
                    'class' => \notamedia\sentry\SentryTarget::className(),
                    'dsn' => $params['sentry_url'],
                    'levels' => ['error', 'warning']
                ],
            ],
        ],

Код который вызывает ошибку

        $k = null;
        $k->fasfdasdsar5();

В результате в sentry пришло 2 ошибки
image

В одном сообщении подробное описание, прям на какой строчке ошибка, а в другом просто текст ошибки.

Я думаю вызвано это тем что Yii ошибку на два сообщения в логах разбивает. Можно попробовать при отправке исключить одно из сообщений.

Sentry domain now .io

Just so you know, I was having trouble making the plugin work. Then, finally, I noticed that your demo code uses sentry.com whereas sentry gave me sentry.io.

Changing that fixed it. You might want to note this in the docs.

Thanks for your plugin!

ClientOptions is never used

Hello!

I want to use parameter release in \Sentry\init (like here) and it is impossible because no extra parameters are passed into this function. clientOptions property is never used in SentryTarget, but it could be used for passing such parameters into Sentry client.

How can I quickly change this, or PR needed?

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.