Loading
feat(sidekiq): alert when the package metadata v3 sync stops working
What does this MR do and why?
Summary
This MR adds two alerts for the package metadata sync, which can fail on every run on GitLab.com without anyone noticing: it logs the failure and returns, so the Sidekiq job still succeeds and the Sidekiq error SLI stays green. Tracked in gitlab-org/gitlab#643222 (closed).
Details
- Two alerts, both
s3, built on the newpackage_metadata_v3_syncapplication SLI from gitlab-org/gitlab!275238 (merged), and routed to#g_ast-composition-analysis-alertsthroughteam: composition_analysis(the team route matchesenv=gprdonly).SidekiqServicePackageMetadataV3SyncErrorSLOViolation, generated from the metrics catalog: too many syncs fail.PackageMetadataMalwareAdvisorySyncStalled, a hand-written rule: no malware advisory sync has succeeded in 1 hour. This catches a sync that stopped running altogether, which the error ratio can't see because both counters stop.
- Safe to merge first: neither alert can fire until the Rails MR ships the metric. The stalled rule returns nothing without the series, and the SLO alert needs 50 samples.
- Playbook: one page for both alerts,
PackageMetadataMalwareAdvisorySyncStalled.md. The generated alert links to it throughalertRunbook. - Generated files: the
mimir-rules/**/autogenerated-*files aremake generateoutput. - How it was checked: promtool tests and generated-rule checks, see How to set up and validate locally.
Why these thresholds
| Setting | Value | Why |
|---|---|---|
| Error SLO | 1% (errorRatio: 0.99) |
One failed request to the distribution service fails every registry in that run, so two failed runs in an hour fire the 1-hour alert. |
| Minimum samples | 50 per window | The sync makes about 80 measurements an hour for malware advisories; the default of 3600 would never be reached. |
| Traffic cessation alert | off | The traffic is too low for it; the stalled rule covers a stopped sync. |
| Stalled window | 1 hour, for: 10m |
The sync runs every 5 minutes, and a slow first-time download can hold the lock for up to 22 minutes. It ran 287 to 288 times a day on GitLab.com from 2026-11-20 to 2026-11-27. |
| Stalled scope | malware advisories, gprd only | The only dataset with a measured baseline so far; licenses and advisories can follow. |
How to set up and validate locally
| Check | Result |
|---|---|
make generate, run twice |
No drift in this MR's files |
promtool test rules test/mimir-rules/package-metadata-v3-sync-alerts_test.yml |
5 cases pass: quiet while syncs succeed, at one success every 40 minutes, and with no data; fires 10 minutes after the last success leaves the window, whether the sync stopped or every sync failed |
The same tests with the threshold changed to < -1, then the window to 10m |
The two firing cases fail, so the tests catch both mistakes |
mimirtool rules check on the new rule file and the three sidekiq-service-level-alerts.yml |
Exit 0 |
jsonnetfmt --test on the changed Jsonnet |
Clean |
References
- Issue: gitlab-org/gitlab#643222 (closed)
- Rails MR adding the metric: gitlab-org/gitlab!275238 (merged)
- Precedent: the
duo_workflow_session_credits_syncSLI and itsDuoWorkflowSessionCreditsSyncStalealert
Edited by Bala Kumar