Browse Source

ref(dev): Add excluded celery beat tasks from crons (#53163)

Excludes monitors with sub-minute schedules from being auto-instrumented
and stops log noise.
Richard Ortenberg 1 year ago
parent
commit
7d492b2b8d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/sentry/utils/sdk.py

+ 8 - 1
src/sentry/utils/sdk.py

@@ -436,6 +436,13 @@ def configure_sdk():
     from sentry_sdk.integrations.redis import RedisIntegration
     from sentry_sdk.integrations.redis import RedisIntegration
     from sentry_sdk.integrations.threading import ThreadingIntegration
     from sentry_sdk.integrations.threading import ThreadingIntegration
 
 
+    # exclude monitors with sub-minute schedules from using crons
+    exclude_beat_tasks = [
+        "flush-buffers",
+        "sync-options",
+        "schedule-digests",
+    ]
+
     sentry_sdk.init(
     sentry_sdk.init(
         # set back the sentry4sentry_dsn popped above since we need a default dsn on the client
         # set back the sentry4sentry_dsn popped above since we need a default dsn on the client
         # for dynamic sampling context public_key population
         # for dynamic sampling context public_key population
@@ -444,7 +451,7 @@ def configure_sdk():
         integrations=[
         integrations=[
             DjangoAtomicIntegration(),
             DjangoAtomicIntegration(),
             DjangoIntegration(signals_spans=False),
             DjangoIntegration(signals_spans=False),
-            CeleryIntegration(monitor_beat_tasks=True),
+            CeleryIntegration(monitor_beat_tasks=True, exclude_beat_tasks=exclude_beat_tasks),
             # This makes it so all levels of logging are recorded as breadcrumbs,
             # This makes it so all levels of logging are recorded as breadcrumbs,
             # but none are captured as events (that's handled by the `internal`
             # but none are captured as events (that's handled by the `internal`
             # logger defined in `server.py`, which ignores the levels set
             # logger defined in `server.py`, which ignores the levels set