Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA] Notifier le support en cas d’échec de synchro sur la base de donnée #3702

Merged

Conversation

hmeneuvrier
Copy link
Collaborator

@hmeneuvrier hmeneuvrier commented Feb 11, 2025

Ticket

#3636

Description

Création d'un endpoint sur histologe pour notifier le support en cas de pb de synchro

Changements apportés

  • Ajout et modification de vars d'env
  • Modification du script de synchro
  • ajout d'un endpoint pour jeter une exception dans le SecurityController
  • Modification du ExceptionListener pour améliorer le mail d'erreur envoyé au support

Pré-requis

Tests

Ce n'est pas si simple à tester. J'ai fait 2 tests de mon côté.
J'ai copié les lignes 47 à 76 du script dans un autre fichier bash placé à côté d'un dump récent pour voir si l'ajout de la ligne 51 permettait la création de la Vue, j'ai l'impression que oui.
Et sinon j'ai fait le curl dans une invite de commande pour vérifier l'envoi du mail d'erreur.
Si vous avez des idées pour tester mieux que ça, trop bien !

@hmeneuvrier hmeneuvrier force-pushed the feature/3636-qa-notifier-le-support-pb-synchro-metabase branch from 19e2f6f to ca5f2ac Compare February 12, 2025 08:05
@hmeneuvrier hmeneuvrier changed the title wip error synchro #3636 [QA] Notifier le support en cas d’échec de synchro sur la base de donnée Feb 12, 2025
@@ -44,7 +44,7 @@ ESABORA_CRON_CLOCK_SLEEP_INTERVAL=60 #second
ESABORA_CRON_SCHEDULE_SYNC_SCHS='*/1 * * * *'
ESABORA_CRON_SCHEDULE_SYNC_SISH='*/2 * * * *'
ESABORA_CRON_SCHEDULE_SYNC_SISH_INTERVENTION='*/3 * * * *'
METABASE_CRON_SCHEDULE_SYNC_BDD='0 1 * * *'
METABASE_CRON_SCHEDULE_SYNC_BDD='0 3 * * *'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changement de l'heure car les backups se terminent entre 1h et 2h du matin

@@ -70,6 +70,8 @@ HISTORY_TRACKING_ENABLE=1
DELAY_MIN_CHECK_NEW_SIGNALEMENT_FILES=30 #minutes
ALBERT_API_KEY=
FEATURE_MULTI_TERRITORIES=0
SEND_ERROR_EMAIL_TOKEN=
HISTOLOGE_PROD_URL=
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajout d'un token pour l'envoi de mail, et de l'url de la prod pour appeler le endpoint

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'on renseignerait pas l'url directement ici (pour éviter d'oublier de le changer à l'avenir) ?

@@ -48,8 +48,29 @@ backup_file_name="$(ls /app/*.sql)"
echo ">>> Remove CREATE and USE instruction"
sed -i '/CREATE DATABASE/d' "${backup_file_name}"
sed -i '/^USE/d' "${backup_file_name}"
sed -i '/DEFINER/d' "${backup_file_name}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposition du support scalingo pour éviter le pb sur la création de la vue


echo ">>> Error reported to API."
fi

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Script pour intercepter l'erreur et envoyer un mail au support via le endpoint

@@ -134,4 +136,29 @@ public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}

#[Route('/send-error-email', methods: ['POST'])]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne suis pas sûre que ce soit le meilleur controller pour ce endpoint. Si vous avez d'autres idées

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que j'aurais fait un contrôleur dédié mais ca me choque pas non plus ici

@hmeneuvrier hmeneuvrier marked this pull request as ready for review February 12, 2025 12:46
Copy link
Collaborator

@numew numew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quelques remarques mais j'approuve

@@ -70,6 +70,8 @@ HISTORY_TRACKING_ENABLE=1
DELAY_MIN_CHECK_NEW_SIGNALEMENT_FILES=30 #minutes
ALBERT_API_KEY=
FEATURE_MULTI_TERRITORIES=0
SEND_ERROR_EMAIL_TOKEN=
HISTOLOGE_PROD_URL=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce qu'on renseignerait pas l'url directement ici (pour éviter d'oublier de le changer à l'avenir) ?

@@ -134,4 +136,29 @@ public function logout(): void
{
throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
}

#[Route('/send-error-email', methods: ['POST'])]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que j'aurais fait un contrôleur dédié mais ca me choque pas non plus ici

Copy link
Collaborator

@emilschn emilschn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok pour tester IRL

@emilschn emilschn merged commit 4044add into develop Feb 13, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants