PLT-2119: Replace per-tag PSLs with single tag-agnostic PrometheusServiceLevel#620
Open
eddiebarth1 wants to merge 4 commits into
Open
PLT-2119: Replace per-tag PSLs with single tag-agnostic PrometheusServiceLevel#620eddiebarth1 wants to merge 4 commits into
eddiebarth1 wants to merge 4 commits into
Conversation
257e2a9 to
fd86181
Compare
fd86181 to
6c13ce6
Compare
eddiebarth1
commented
Jun 9, 2026
…viceLevel
Every deploy created a per-tag PSL ({app}-{target}-{tag}-servicelevels);
Sloth regenerates burn-rate rules on any PSL change, so each deploy reset
burn-rate windows and emitted duplicate alert series per revision.
- One stable PSL per app/target ({app}-{target}-servicelevels); the name
comes from one helper shared by the sync and delete paths.
- SLI queries preserve per-revision granularity: sum by (tag) (rate(...))
replaces the per-tag sum(rate(...{tag=X})). Verified numerically
identical per tag against prod Thanos.
- Single writer, modeled on syncSLORules: ResourceSyncer.syncServiceLevels
upserts while the leading releasable revision has enabled SLOs, deletes
otherwise. Steady state never writes (CreateOrUpdate no-ops on identical
specs); the PSL only changes when SLO definitions change.
- Teardown deletes the shared PSL before the ReleaseManager self-deletes.
Unlike namespace-scoped service-wide objects, the PSL lives in the
cross-app service-levels namespace where neither namespace cascade nor
cross-namespace OwnerReferences can reach it.
- DeleteServiceLevels deletes by deterministic name; the old LabelTag=""
selector never matched an absent label (silent no-op).
- Enabled=false is filtered once at the source (prepareServiceLevelObjectives)
so PSL, SLO rules, and ServiceMonitors uniformly stop observing.
- Legacy per-tag PSLs are scrubbed per-incarnation via
deleteTaggedServiceLevels; SyncTaggedServiceLevels and its helpers are
removed as dead code.
- Tests: plan-level sync/delete units plus controller-level coverage for
prepareServiceLevelObjectives filtering, the sync-vs-delete decision,
and a teardown regression test.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codify the scope model from Sofie's review: syncer.go owns app/target-lifetime objects, incarnation.go and state handlers own per-revision objects, and shared-resource cleanup requires visibility of the full incarnation collection (PICCHU-INV-SCOPE-1/2/3). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e32f633 to
2787ee9
Compare
Per Sofie's review: - serviceLevelIndicator.tagKey lets a service expose its revision under a label other than "tag" (kbfd defaults it to "tag"; no service overrides it today). The shared SLI source now label_replace's a custom tagKey into the canonical "tag" label so Sloth recording rules and burn-rate alerts keep the label the rollback pipeline matches on, preserving the adjustability the old per-tag queries had. Covered by a fixture SLO using tagKey: destination_workload. - Restore the skip log when service-levels-namespace is unset, matching the old syncTaggedServiceLevels behavior. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…review
- SyncServiceLevels now mirrors the original SyncTaggedServiceLevels
structure exactly: list-shaped builder with (value, error) return,
Enabled checked in the plan, name built by a serviceLevelName method.
- DeleteServiceLevels returns to the list/selector form. The only change
from the original is dropping LabelTag:"" from the selector - equality
selectors never match an absent label, which made the old delete a
silent no-op. The {app, target} selector also sweeps lingering legacy
per-tag PSLs once observation is off; test covers shared + legacy
deletion and other-app isolation.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes PLT-2119
Why
Every deploy created a per-tag PSL (
{app}-{target}-{tag}-servicelevels). Sloth regenerates burn-rate rules whenever a PSL changes, so every deploy reset the burn-rate windows and emitted a fresh alert series per revision — noisy duplicate SLO alerts, untrustworthy burn-rate trends.What
{app}-{target}-servicelevels), built bySyncServiceLevelsmirroring the structure of the originalSyncTaggedServiceLevels.sum by (tag) (rate(...))replaces the per-tagsum(rate(...{tag="X"})). Numerically identical per tag (verified below).ResourceSyncer.syncServiceLevelsupserts when the leading releasable revision has enabled SLOs, deletes otherwise. Steady state never writes —CreateOrUpdateno-ops on identical specs, so the PSL only changes when SLO definitions change (rare, and the one case where windows still reset, since the rules genuinely changed).DeleteServiceLevelskeeps the list/selector form, minus the bug. The old selector includedLabelTag: "", which never matches an absent label — cleanup was a silent no-op. The selector is now{app, target}, which matches the shared PSL and also sweeps any lingering legacy per-tag PSLs once observation is off.serviceLevelIndicator.tagKey. No service overrides it today (kbfd defaults it totag), but a custom key (e.g.destination_workload) islabel_replace'd into the canonicaltaglabel so the rollback pipeline keeps matching.PICCHU-INV-SCOPE-*invariants in CLAUDE.md, so the lesson outlives this PR.Behavior changes
Enabled: falsenow also removes the SLO's recording rules and ServiceMonitor (previously only the PSL honored it). Disabled uniformly means "do not observe".IsRevisionTriggeredmatches picchu's own per-tag canary rules (canary="true"/slo="true"—syncCanaryRules, not in this diff). The PSL feeds human burn-rate alerting only.Verified against prod Thanos (2026-06-09, pre-ship)
{app}:{slo}:errors|total, e.g.medium2:authentication_account_login_success:total) carrytagon all 4 production clusters.max without (sloth_window)→tagsurvives into firing alerts.tag: only clientele (aggregates bysource_canonical_revision) and drizzle (metric has notaglabel) — both already have no per-revision SLI today; not regressions. Nois_grpcSLOs exist fleet-wide.Test plan
make test/make fmt vet; unit tests for the lifecycle (Enabled filtering, sync-vs-delete decision, teardown deletes the PSL before RM self-delete)sloth_id(values are identical; watch prometheus-slo for duplicate-sample warnings until scrub completes)Enabled: falseflip removes rules + ServiceMonitor; decommission deletes the shared PSL🤖 Generated with Claude Code