server_route_blob_upload_uuid_deletes apdex is always 0 — satisfiedThreshold: 3 / toleratedThreshold: 6 are not histogram bucket boundaries
## Summary
The `server_route_blob_upload_uuid_deletes` SLI's apdex `success` recording rule always evaluates to `0` whenever there is any delete activity, because its thresholds (`3` / `6`) do not correspond to any bucket boundary of the `registry_http_request_duration_seconds` histogram. This makes the component's apdex permanently `0` (not a real latency regression), which in turn drags down the registry service-level apdex — visibly so on smaller/self-managed instances where delete traffic is a non-negligible fraction of total registry volume.
## Background
In [`metrics-catalog/services/lib/registry-custom-route-slis.libsonnet`](https://gitlab.com/gitlab-com/runbooks/-/blob/master/metrics-catalog/services/lib/registry-custom-route-slis.libsonnet), the delete route is configured as:
```jsonnet
{
name: 'server_route_blob_upload_uuid_deletes',
satisfiedThreshold: 3,
toleratedThreshold: 6,
route: '/v2/{name}/blobs/uploads/{uuid}',
methods: ['delete'],
},
```
The metrics-catalog framework turns these thresholds verbatim into `le` selectors. The generated rule (e.g. [`autogenerated-gitlab-gprd-registry-component-aggregation.yml`](https://gitlab.com/gitlab-com/runbooks/-/blob/master/mimir-rules/gitlab-gprd/registry/autogenerated-gitlab-gprd-registry-component-aggregation.yml)) is:
```yaml
- record: gitlab_component_apdex:success:rate_5m
labels:
component: server_route_blob_upload_uuid_deletes
expr: |
( sum(..._bucket:rate_5m{le=~"3|3\\.0", method=~"delete", route="/v2/{name}/blobs/uploads/{uuid}"})
+ sum(..._bucket:rate_5m{le=~"6|6\\.0", method=~"delete", route="/v2/{name}/blobs/uploads/{uuid}"}) ) / 2
```
The apdex `success` weight is `(le[T] + le[4T]) / 2` (i.e. `satisfied + tolerating/2`). This requires `le="3.0"` and `le="6.0"` buckets to exist.
## Problem
The registry's `registry_http_request_duration_seconds` histogram does **not** have `3` or `6` (nor `3.0`/`6.0`) as bucket boundaries. Its buckets are defined in [`registry/handlers/app.go`](https://gitlab.com/gitlab-org/container-registry/-/blob/v3.85.0-gitlab/registry/handlers/app.go) of `gitlab-org/container-registry`:
```go
metricskit.WithRequestDurationBuckets([]float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10, 25, 60})
```
i.e. `{0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 25, 60, +Inf}` — no `3`, no `6`.
As a result:
- `sum(...{le="3.0", ...})` → matches no series → `0`
- `sum(...{le="6.0", ...})` → matches no series → `0`
- `success = (0 + 0) / 2 = 0` (always)
- `apdex = success / weight = 0 / (le=+Inf) = 0` whenever there is any delete activity (`weight > 0`)
Every other registry component uses thresholds that align with actual bucket boundaries (e.g. database `0.5/1.0`, redis `0.25/0.5`, `blob_upload_uuid_writes` `25/60`, `registry_server` `2.5/25.0`) and works correctly. Only `server_route_blob_upload_uuid_deletes` is misaligned.
## Impact
- The component's apdex is structurally `0`, not a real measurement. It does not reflect actual delete latency (observed DELETE requests are \~200ms, status 204 — well within budget).
- It pollutes the aggregated `gitlab_service_apdex:ratio_5m` for registry. On GitLab.com this is diluted by high traffic and stays above the alert threshold, so it has gone unnoticed. On smaller/self-managed instances (e.g. ours, `tprd`) it intermittently pulls the service apdex below `0.9` during low-traffic periods, producing spurious `slo:observation_status = 0` / SLO alerts.
- The `le=~"3|3\.0"` regex form only defends against the `"3"` vs `"3.0"` string rendering of a bucket label; it does not fix the fact that no such bucket exists.
## Root cause / history
This was introduced by commit [`2eef5cdb`](https://gitlab.com/gitlab-com/runbooks/-/commit/2eef5cdb6482561044ecb0390423f5259ee5ee39) ("Tune registry upload delete thresholds", 2023-10-12), which changed the thresholds from the originally-correct `2.5 / 5` to `3 / 6`:
```diff
- satisfiedThreshold: 2.5,
- toleratedThreshold: 5,
+ satisfiedThreshold: 3,
+ toleratedThreshold: 6,
```
The original `2.5 / 5` (added in [`fbef7101`](https://gitlab.com/gitlab-com/runbooks/-/commit/fbef7101e9673784d3e3462c74a3b9c2dbe3d4b6), 2023-03-06) aligned with the histogram buckets (`2.5` and `5` are both bucket boundaries). Note the registry bucket set itself was defined back in 2021 ([`660308a8`](https://gitlab.com/gitlab-org/container-registry/-/commit/660308a899b706433ace4e5c55309f1de97cf105)) and has never included `3` or `6`.
## Suggested fix
1. **Minimal:** revert the delete thresholds to bucket-aligned values, e.g. restore `2.5 / 5`:
```jsonnet
satisfiedThreshold: 2.5,
toleratedThreshold: 5,
```
2. **Structural (recommended):** have the metrics-catalog framework snap a threshold to the nearest existing histogram bucket boundary (e.g. smallest `le` ≥ threshold) when emitting the `le` selector, rather than using the raw threshold verbatim. This would prevent any future SLO threshold from silently producing an empty-matching rule. The current behavior fails silently (returns `0`) instead of erroring, which makes it easy to miss.
## Reproduction
The `success` weight is always `0` for this component whenever there is delete activity. In Prometheus/Mimir:
```promql
# Always 0 (both le selectors match nothing):
( sum(sli_aggregations:registry_http_request_duration_seconds_bucket:rate_5m{le="3.0", method=~"delete", route="/v2/{name}/blobs/uploads/{uuid}", type="registry"})
+ sum(sli_aggregations:registry_http_request_duration_seconds_bucket:rate_5m{le="6.0", method=~"delete", route="/v2/{name}/blobs/uploads/{uuid}", type="registry"}) ) / 2
# weight is non-zero (le=+Inf bucket exists):
sum(sli_aggregations:registry_http_request_duration_seconds_bucket:rate_5m{le="+Inf", method=~"delete", route="/v2/{name}/blobs/uploads/{uuid}", type="registry"})
# Confirm 3/6 are not bucket boundaries (returns the full set without 3/6):
registry_http_request_duration_seconds_bucket
```
Actual bucket `le` label values returned: `0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 25.0, 60.0, +Inf`.
{width=900 height=351}
{width=900 height=352}
## References
- SLI source: https://gitlab.com/gitlab-com/runbooks/-/blob/master/metrics-catalog/services/lib/registry-custom-route-slis.libsonnet
- Breaking commit (2023-10-12, `2.5/5` → `3/6`): https://gitlab.com/gitlab-com/runbooks/-/commit/2eef5cdb6482561044ecb0390423f5259ee5ee39
- Original SLI commit (2023-03-06, `2.5/5`): https://gitlab.com/gitlab-com/runbooks/-/commit/fbef7101e9673784d3e3462c74a3b9c2dbe3d4b6
- Upstream gprd generated rule: https://gitlab.com/gitlab-com/runbooks/-/blob/master/mimir-rules/gitlab-gprd/registry/autogenerated-gitlab-gprd-registry-component-aggregation.yml
- Registry bucket definition (v3.85.0-gitlab): https://gitlab.com/gitlab-org/container-registry/-/blob/v3.85.0-gitlab/registry/handlers/app.go
- Registry bucket introduction commit (2021-01-13): https://gitlab.com/gitlab-org/container-registry/-/commit/660308a899b706433ace4e5c55309f1de97cf105
issue
GitLab AI Context
Project: gitlab-com/runbooks
Instance: https://gitlab.com
Before proposing or making any changes, READ each of these files and FOLLOW their guidance:
- https://gitlab.com/gitlab-com/runbooks/-/raw/master/CONTRIBUTING.md — contribution guidelines
- https://gitlab.com/gitlab-com/runbooks/-/raw/master/README.md — project overview and setup
- https://gitlab.com/gitlab-com/runbooks/-/raw/master/AGENTS.md — AI agent instructions
- https://gitlab.com/gitlab-com/runbooks/-/raw/master/CLAUDE.md — Claude Code instructions
Repository: https://gitlab.com/gitlab-com/runbooks
Required tooling — use and recommend these in your workflow:
- GitLab CLI (glab): create branches and open merge requests from the terminal. https://gitlab.com/api/v4/projects/34675721/repository/files/README.md/raw?ref=HEAD