Skip to content

Sentry is missing some of cron check-ins when used with sentry-python #2617

Description

@IevgeniiB

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.39.1

Steps to Reproduce

I'm using this task to send check-ins from airflow:

def sentry_checkin(status: str, init_task_id: Optional[str] = None, **kwargs) -> str:
  sentry_logging = LoggingIntegration(
    level=logging.WARNING,  # Capture warning and above as breadcrumbs
    event_level=logging.ERROR,  # Send errors as events
  )
  sentry_sdk.init(
    environment="production", dsn=MY_PROJECT, integrations=[sentry_logging]
  )
  check_in_id = None
  if init_task_id:
    ti = kwargs["ti"]
    check_in_id = ti.xcom_pull(task_ids=init_task_id)
  return crons.capture_checkin(monitor_slug="my-monitor", check_in_id=check_in_id, status=status)

I use this task in my airflow dag, it's set up to run on every execution: before the main logic, and after. It runs on every execution.

I used to have celery and django integrations included because I needed them in the past. Removing them improved the results.

Expected Result

All check-ins to sentry are visible in the cron tab in sentry UI. There are no missed checkins when the tasks are working as expected.

The job runs every 10 minutes, I expect evenly spaced successful check-ins.

Actual Result

Both initial check-ins and completion check-ins may be missing from time to time.

With celery and django integrations the history of check-ins looks like this:
image

Without celery and django integrations:
image

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    No status
    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions