diff --git a/api/management/commands/ingest_disaster_law.py b/api/management/commands/ingest_disaster_law.py index 313f7e72fe..c900b5f4bc 100644 --- a/api/management/commands/ingest_disaster_law.py +++ b/api/management/commands/ingest_disaster_law.py @@ -1,11 +1,14 @@ import requests from bs4 import BeautifulSoup from django.core.management.base import BaseCommand +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_DISASTER_LAW) class Command(BaseCommand): help = "Add ICRC data" diff --git a/api/management/commands/ingest_icrc.py b/api/management/commands/ingest_icrc.py index f6e65d90c2..cdf029b2bd 100644 --- a/api/management/commands/ingest_icrc.py +++ b/api/management/commands/ingest_icrc.py @@ -1,11 +1,14 @@ import requests from bs4 import BeautifulSoup from django.core.management.base import BaseCommand +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CountryICRCPresence, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_ICRC) class Command(BaseCommand): help = "Add ICRC data" diff --git a/api/management/commands/ingest_ns_capacity.py b/api/management/commands/ingest_ns_capacity.py index 69b7d80d42..c0c65853b2 100644 --- a/api/management/commands/ingest_ns_capacity.py +++ b/api/management/commands/ingest_ns_capacity.py @@ -1,11 +1,14 @@ import requests from django.conf import settings from django.core.management.base import BaseCommand +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CountryCapacityStrengthening, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_NS_CAPACITY) class Command(BaseCommand): help = "Add ns contact details" @@ -44,7 +47,7 @@ def handle(self, *args, **kwargs): text_to_log = "%s Ns capacity added" % ocaa_count logger.info(text_to_log) body = { - "name": "ingest_ns_capaciity", + "name": "ingest_ns_capacity", "message": text_to_log, "num_result": ocaa_count, "status": CronJobStatus.SUCCESSFUL, diff --git a/api/management/commands/ingest_ns_contact.py b/api/management/commands/ingest_ns_contact.py index 1d01dd759f..5af14f47b0 100644 --- a/api/management/commands/ingest_ns_contact.py +++ b/api/management/commands/ingest_ns_contact.py @@ -6,11 +6,14 @@ from django.conf import settings from django.core.management.base import BaseCommand from requests.auth import HTTPBasicAuth +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_NS_CONTACT) class Command(BaseCommand): help = "Add ns contact details" diff --git a/api/management/commands/ingest_ns_directory.py b/api/management/commands/ingest_ns_directory.py index f42421a11d..a9157e2179 100644 --- a/api/management/commands/ingest_ns_directory.py +++ b/api/management/commands/ingest_ns_directory.py @@ -3,11 +3,14 @@ from django.conf import settings from django.core.management.base import BaseCommand from requests.auth import HTTPBasicAuth +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CountryDirectory, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_NS_DIRECTORY) class Command(BaseCommand): help = "Add ns contact details" diff --git a/api/management/commands/ingest_ns_document.py b/api/management/commands/ingest_ns_document.py index 0864b02b7c..eb2200ac44 100644 --- a/api/management/commands/ingest_ns_document.py +++ b/api/management/commands/ingest_ns_document.py @@ -5,11 +5,14 @@ import requests from django.conf import settings from django.core.management.base import BaseCommand +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CountryKeyDocument, CronJob, CronJobStatus +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_NS_DOCUMENT) class Command(BaseCommand): help = "Add ns documents" diff --git a/api/management/commands/ingest_ns_initiatives.py b/api/management/commands/ingest_ns_initiatives.py index d759702e5c..09460380cf 100644 --- a/api/management/commands/ingest_ns_initiatives.py +++ b/api/management/commands/ingest_ns_initiatives.py @@ -3,11 +3,14 @@ import requests from django.conf import settings from django.core.management.base import BaseCommand +from sentry_sdk.crons import monitor from api.logger import logger from api.models import Country, CronJob, CronJobStatus, NSDInitiatives +from main.sentry import SentryMonitor +@monitor(monitor_slug=SentryMonitor.INGEST_NS_INITIATIVES) class Command(BaseCommand): help = "Add ns initiatives" diff --git a/databank/management/commands/ingest_climate.py b/databank/management/commands/ingest_climate.py index 7b4580f674..aae074ea3f 100644 --- a/databank/management/commands/ingest_climate.py +++ b/databank/management/commands/ingest_climate.py @@ -2,7 +2,6 @@ import requests from django.core.management.base import BaseCommand -from sentry_sdk.crons import monitor from api.models import CountryType from databank.models import CountryKeyClimate, CountryOverview diff --git a/deploy/helm/ifrcgo-helm/values.yaml b/deploy/helm/ifrcgo-helm/values.yaml index a71cb6214d..d0f0f00149 100644 --- a/deploy/helm/ifrcgo-helm/values.yaml +++ b/deploy/helm/ifrcgo-helm/values.yaml @@ -127,17 +127,32 @@ cronjobs: - command: 'FDRS_INCOME' schedule: '0 0 * * 0' - command: 'ingest_acaps' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' - command: 'ingest_climate' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' - command: 'ingest_databank' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' - command: 'ingest_hdr' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' - command: 'ingest_unicef' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' - command: 'ingest_worldbank' - schedule: '0 0 * * *' + schedule: '0 0 * * 0' + - command: 'ingest_disaster_law' + schedule: '0 0 * * 0' + - command: 'ingest_ns_contact' + schedule: '0 0 * * 0' + - command: 'ingest_ns_capacity' + schedule: '0 0 * * 0' + - command: 'ingest_ns_directory' + schedule: '0 0 * * 0' + - command: 'ingest_ns_document' + schedule: '0 0 * * 0' + - command: 'ingest_ns_initiatives' + schedule: '0 0 * * 0' + - command: 'ingest_icrc' + schedule: '0 0 * * 0' + elasticsearch: enabled: true diff --git a/main/sentry.py b/main/sentry.py index 4148d1c046..5ae70114de 100644 --- a/main/sentry.py +++ b/main/sentry.py @@ -116,12 +116,19 @@ class SentryMonitor(models.TextChoices): UPDATE_SURGE_ALERT_STATUS = "update_surge_alert_status", "1 */12 * * *" FDRS_ANNUAL_INCOME = "fdrs_annual_income", "0 0 * * 0" FDRS_INCOME = "FDRS_INCOME", "0 0 * * 0" - INGEST_ACAPS = "ingest_acaps", "0 0 * * *" - INGEST_CLIMATE = "ingest_climate", "0 0 * * *" - INGEST_DATABANK = "ingest_databank", "0 0 * * *" - INGEST_HDR = "ingest_hdr", "0 0 * * *" - INGEST_UNICEF = "ingest_unicef", "0 0 * * *" - INGEST_WORLDBANK = "ingest_worldbank", "0 0 * * *" + INGEST_ACAPS = "ingest_acaps", "0 0 * * 0" + INGEST_CLIMATE = "ingest_climate", "0 0 * * 0" + INGEST_DATABANK = "ingest_databank", "0 0 * * 0" + INGEST_HDR = "ingest_hdr", "0 0 * * 0" + INGEST_UNICEF = "ingest_unicef", "0 0 * * 0" + INGEST_WORLDBANK = "ingest_worldbank", "0 0 * * 0" + INGEST_DISASTER_LAW = "ingest_disaster_law", "0 0 * * 0" + INGEST_NS_CONTACT = "ingest_ns_contact", "0 0 * * 0" + INGEST_NS_CAPACITY = "ingest_ns_capacity", "0 0 * * 0" + INGEST_NS_DIRECTORY = "ingest_ns_directory", "0 0 * * 0" + INGEST_NS_DOCUMENT = "ingest_ns_document", "0 0 * * 0" + INGEST_NS_INITIATIVES = "ingest_ns_initiatives", "0 0 * * 0" + INGEST_ICRC = "ingest_icrc", "0 0 * * 0" @staticmethod def load_cron_data() -> typing.List[typing.Tuple[str, str]]: