Skip to content

Commit

Permalink
Merge pull request #159 from silinternational/release/5.1.0
Browse files Browse the repository at this point in the history
Release 5.1.0 - Use Sentry monitor service
  • Loading branch information
briskt authored Nov 21, 2023
2 parents 177509d + 14adb6f commit bf22519
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ google-auth.json

# PHP-CS-Fixer cache file.
.php_cs.cache
.php-cs-fixer.cache

dockercfg

Expand Down
3 changes: 2 additions & 1 deletion application/common/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
'clientOptions' => [
'attach_stacktrace' => false, // stack trace identifies the logger call stack, not helpful
'environment' => YII_ENV,
'release' => 'idp-id-sync@5.0.0',
'release' => 'idp-id-sync@5.1.0',
'before_send' => function (Event $event) use ($idpName): ?Event {
$event->setExtra(['idp' => $idpName]);
return $event;
Expand All @@ -147,5 +147,6 @@
'syncSafetyCutoff' => Env::get('SYNC_SAFETY_CUTOFF'),
'allowEmptyEmail' => Env::get('ALLOW_EMPTY_EMAIL', false),
'enableNewUserNotification' => Env::get('ENABLE_NEW_USER_NOTIFICATION', false),
'sentryMonitorSlug' => Env::get('SENTRY_MONITOR_SLUG', 'idp-id-sync'),
],
];
3 changes: 2 additions & 1 deletion application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"guzzlehttp/guzzle": "^6.2",
"google/apiclient": "^2.0",
"codemix/yii2-streamlog": "^1.3",
"notamedia/yii2-sentry": "^1.7"
"notamedia/yii2-sentry": "^1.7",
"sentry/sentry": "^3.22"
},
"require-dev": {
"behat/behat": "^3.3",
Expand Down
2 changes: 1 addition & 1 deletion application/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions application/console/controllers/BatchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,32 @@

namespace Sil\Idp\IdSync\console\controllers;

use Sentry\CheckInStatus;
use Sil\Idp\IdSync\common\traits\SyncProvider;
use Yii;
use yii\console\Controller;

use function Sentry\captureCheckIn;

class BatchController extends Controller
{
use SyncProvider;

public function actionFull()
{
$checkInId = captureCheckIn(
slug: Yii::$app->params['sentryMonitorSlug'],
status: CheckInStatus::inProgress()
);

$synchronizer = $this->getSynchronizer();
$synchronizer->syncAllNotifyException();

captureCheckIn(
slug: Yii::$app->params['sentryMonitorSlug'],
status: CheckInStatus::ok(),
checkInId: $checkInId,
);
}

/**
Expand All @@ -21,7 +36,21 @@ public function actionFull()
*/
public function actionIncremental()
{
$checkInId = captureCheckIn(
slug: Yii::$app->params['sentryMonitorSlug'],
status: CheckInStatus::inProgress()
);

$synchronizer = $this->getSynchronizer();
$synchronizer->syncUsersChangedSince(strtotime('-11 minutes'));

$synchronizer = $this->getSynchronizer();
$synchronizer->syncAllNotifyException();

captureCheckIn(
slug: Yii::$app->params['sentryMonitorSlug'],
status: CheckInStatus::ok(),
checkInId: $checkInId,
);
}
}
3 changes: 3 additions & 0 deletions local.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ ID_STORE_ADAPTER=
# To use Sentry for error alerting, obtain DSN from Sentry dashboard: Settings - Projects - (project) - Client Keys
SENTRY_DSN=

# To use Sentry monitor service, create a monitor and enter the slug value here
SENTRY_MONITOR_SLUG=

## [prod|dev|test], app defaults to prod
#APP_ENV=

Expand Down

0 comments on commit bf22519

Please sign in to comment.