Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

fix/repo-updater: add WARN level logs every time we sync a code host #64519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ggilmore
Copy link
Contributor

@ggilmore ggilmore commented Aug 16, 2024

Closes https://linear.app/sourcegraph/issue/SRC-557/sourcegraph-deleted-all-repos-during-github-outage

Github recently had an incident, that caused a number of Sourcegraph's users repos to be deleted and recloned.

After auditing the code, we believe a number / most of these cases are a form of a byzantine fault. Namely, the github API was failing in such a way that it was returning valid-looking (200 status code, well-formed JSON responses) responses that were otherwise incorrect (e.g. returning an empty list [] for the set of repositories) instead of a more easily detectable error (non-200 status code, malformed JSON, etc.)

In order to be able to determine this in the future, this PR adds more WARN level logs to the syncing logic that logs the number of repositories that were added/removed/modified/etc. + whether or not an error occurred during every sync.

We chose the WARN log level to that it will be emitted by default on all Sourcegraph deployments. This will make for more voluminous logs, but its a critical debugging tool that we need.

Test plan

Run sg start, and see repo-updater logs that look like:

[   repo-updater] WARN repo-updater.syncer repos/syncer.go:377 finished listing repositories from external service {"svc": {"name": "GITHUB #1", "id": 3}, "syncProgress": {"synced": 22, "errors": 0, "added": 22, "removed": 0, "modified": 0, "unmodified": 0}, "seen": 22, "modified": true, "error": "<nil>"}

Changelog

repo-updater now emits logs that log the result of every code host sync.

@cla-bot cla-bot bot added the cla-signed label Aug 16, 2024
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ggilmore and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Aug 16, 2024
@ggilmore ggilmore force-pushed the graphite-ggilmorefix_repo-updater_add_warn_level_logs_every_time_we_sync_a_code_host branch from 7205d13 to 1c37246 Compare August 16, 2024 20:38
@ggilmore ggilmore marked this pull request as ready for review August 16, 2024 20:52
@ggilmore ggilmore requested a review from a team August 16, 2024 20:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant