You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug 2079908 - [GITHUB-ETL] Github-ETL should report errors to Sentry instead of exiting non-zero on partial failures - #22
Right now, when the GitHub ETL script hits an error on any repository (for
example, no access to a repo, or a GitHub/BigQuery error after retries), it
exits with a non-zero code. The Kubernetes CronJob pod then reports the whole
run as failed, even when the other repositories were processed and loaded
without problems.
Proposed change:
Add the sentry-sdk dependency and initialize Sentry when the SENTRY_DSN
environment variable is set. If it isn't set, nothing changes, so local
runs, docker-compose and tests behave as they do now.
Send each per-repository failure to Sentry with its full traceback, tagged
with the repository name so it can be filtered in the Sentry UI. Warnings
(retries, backoff) are attached to those events as breadcrumbs.
When some repositories fail, exit 0 so the cron pod no longer shows as
failed. Sentry is where those failures get tracked.
Fatal errors still exit non-zero: missing required environment variables
(GITHUB_REPOS, BIGQUERY_PROJECT, BIGQUERY_DATASET) and top-level
RuntimeErrors. These are also sent to Sentry.
Flush pending Sentry events before the process exits so they aren't lost.
Deployment requirements:
A Sentry project for github-etl.
SENTRY_DSN added to the CronJob's secrets. SENTRY_ENVIRONMENT is optional.
Possible follow-up: Sentry Cron Monitors. Partial failures no longer fail the
pod, so check-ins would alert us if a scheduled run is missed or hangs.
Verify repository failures are captured with tracebacks
tests/test_main.py:636
This test verifies the scope tag and exit code, but not that the failure is actually sent with a traceback. Because sentry_sdk.init is mocked, LoggingIntegration is never installed; removing logger.exception would still leave this test passing. Exercise an in-memory Sentry transport or use explicit capture_exception and assert the captured exception and repo tag.
Verify top-level RuntimeErrors are reported to Sentry
tests/test_main.py:658
The PR also promises to report top-level RuntimeErrors, but this test checks only the return code and flush. With the SDK mocked, the logging integration is inactive, so the test passes even if no event is emitted. Add an assertion through an in-memory transport or switch to explicit capture_exception and assert that call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, when the GitHub ETL script hits an error on any repository (for
example, no access to a repo, or a GitHub/BigQuery error after retries), it
exits with a non-zero code. The Kubernetes CronJob pod then reports the whole
run as failed, even when the other repositories were processed and loaded
without problems.
Proposed change:
environment variable is set. If it isn't set, nothing changes, so local
runs, docker-compose and tests behave as they do now.
with the repository name so it can be filtered in the Sentry UI. Warnings
(retries, backoff) are attached to those events as breadcrumbs.
failed. Sentry is where those failures get tracked.
(GITHUB_REPOS, BIGQUERY_PROJECT, BIGQUERY_DATASET) and top-level
RuntimeErrors. These are also sent to Sentry.
Deployment requirements:
Possible follow-up: Sentry Cron Monitors. Partial failures no longer fail the
pod, so check-ins would alert us if a scheduled run is missed or hangs.