diff --git a/app/components/Controller.php b/app/components/Controller.php index 2558c637a..5f51f02e8 100755 --- a/app/components/Controller.php +++ b/app/components/Controller.php @@ -1,8 +1,17 @@ startTransaction(new TransactionContext( + Yii::app()->controller->id . '/' . $action->id, + )); + + SentrySdk::getCurrentHub()->setSpan($transaction); + if (parent::beforeAction($action)) { // Verifica o timeout com base na Ășltima atividade if (isset(Yii::app()->user->authTimeout)) { @@ -68,4 +83,16 @@ public function beforeAction($action) return false; } + public function afterAction($action) + { + $transaction = SentrySdk::getCurrentHub()->getSpan(); + if ($transaction) { + $transaction->finish(); + } + // SentrySdk::getCurrentHub()->flush(); + + return parent::afterAction($action); + } + + } diff --git a/app/config/main.php b/app/config/main.php index a5e40682d..6667f18c0 100755 --- a/app/config/main.php +++ b/app/config/main.php @@ -217,17 +217,18 @@ 'jsDsn' => getenv("SENTRY_DSN"), 'options' => [ 'traces_sampler' => function (\Sentry\Tracing\SamplingContext $context): float { - return 1; + return 0.25; }, - 'traces_sample_rate' => 1.0, - 'profiles_sample_rate' => 1.0, + 'traces_sample_rate' => 0.25, + 'profiles_sample_rate' => 0.25, 'release' => 'tag@' . TAG_VERSION, 'environment' => INSTANCE, 'before_send' => function (\Sentry\Event $event): \Sentry\Event { \Sentry\configureScope(function (\Sentry\State\Scope $scope): void { $scope->setUser([ 'id' => Yii::app()->user->loginInfos->id, - 'username' => Yii::app()->user->loginInfos->username + 'username' => Yii::app()->user->loginInfos->username, + 'role' => Yii::app()->authManager->getRoles(Yii::app()->user->loginInfos->id) ]); }); return $event; diff --git a/app/controllers/SiteController.php b/app/controllers/SiteController.php index 2c01f22f3..d587f1871 100644 --- a/app/controllers/SiteController.php +++ b/app/controllers/SiteController.php @@ -50,7 +50,6 @@ public function actionIndex() $this->redirect(yii::app()->createUrl('site/login')); } - //$this->redirect(yii::app()->createUrl('student')); $this->loadLogsHtml(5); if (TagUtils::isInstructor()) { diff --git a/index.php b/index.php index e67e4c1de..42050bc3e 100755 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@