Skip to content

cache metrics: route results & first-hit - #4385

Closed
larry-dalmeida wants to merge 2 commits into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:metrics-b-family-result
Closed

larry-dalmeida wants to merge 2 commits into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:metrics-b-family-result

Conversation

@larry-dalmeida

@larry-dalmeida larry-dalmeida commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary of changes

Adds per-route cache result tracking (hit/miss/stale) and first-hit observation time.

How to Verify

Shared setup

mkdir skipper-review && cd skipper-review
git clone https://github.com/zalando/skipper.git skipper && cd skipper
for PR in 4369 4370 4371 4372 4384 4385 4386 4387; do
  git fetch origin pull/$PR/head:pr-$PR
  git worktree add ../skipper-pr-$PR pr-$PR
done
cd ..
git clone https://github.com/larry-dalmeida/skipper-cache-e2e-tests.git
cd skipper-cache-e2e-tests
make verify SKIPPER_CHECKOUT=../skipper-pr-4387

make verify starts or reuses Minikube, the mock origin and the stack; runs the smoke and coalescing checks; and validates supported dashboard queries. It prints a report path and exits non-zero on failure. For outage evidence, run make chaos SKIPPER_CHECKOUT=../skipper-pr-4387 NAME=origin-stale; it includes its own timed load. Requirements: Python 3.9+, Make, Bash, Git, curl, kubectl, Minikube, Docker and Go compatible with Skipper's go.mod. Free ports: 8080, 8081, 6379, 4318, 9091, 9999, 9911 (8089 for endless load). Dynamic URLs: .runtime/urls.txt; stop with make stop.

Validated on #4387 (d767f636): smoke: 6,398 requests, 0 failures; origin-stale: 155 failed revalidations across 77 routes. Smoke metric checks: 42 PASS, 2 fault-only NOT EXERCISED, 0 FAIL.

Focused tests

go -C ../skipper-pr-4385 test -race -count=1 ./filters/cache -run '^TestRouteLabel$'
go -C ../skipper-pr-4385 test -race -count=1 ./metrics -run '^(TestPrometheusCacheRouteResult|TestPrometheusCacheFirstHitSeconds)$'

Expected: 3 focused tests pass. skipper_cache_route_result_total{route,result} labels configured route IDs, so cardinality follows route count, not URLs. Dashboard PromQL derives route families only for IDs matching <family>__<variant>; other setups can group by route or adapt the expression. First-hit metric has samples.

Checklist

Rollback Plan

Revert this PR to restore previous metrics behavior. Revert #4386 first if merged.

References & Additional Context

Depends on #4384; followed by #4386. Adds per-route result distribution and first-hit timing metrics.

E2E Evidence

Latest-chain verification: smoke report (6,398 requests, 0 failures). The stack run uses #4387, which includes this PR; see the shared setup above.

@larry-dalmeida
larry-dalmeida force-pushed the metrics-b-family-result branch from 21cb767 to b5b93ac Compare October 26, 2026 13:25
@larry-dalmeida larry-dalmeida changed the title [cache metrics B] family result & first-hit cache metrics: family result & first-hit Oct 26, 2026
Add skipper_cache_lru_entries{route} and skipper_cache_lru_capacity_bytes gauges. ShardedByteLRU.Usage returns bytes and entry count together; Bytes delegates to it.

Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
Count hit, stale, and miss outcomes per route ID and record the time from process start to the first cache hit.

Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
@larry-dalmeida
larry-dalmeida force-pushed the metrics-b-family-result branch from 1155173 to ccc4f36 Compare October 27, 2026 07:50
@larry-dalmeida larry-dalmeida changed the title cache metrics: family result & first-hit cache metrics: route results & first-hit Oct 27, 2026
@larry-dalmeida

Copy link
Copy Markdown
Collaborator Author

Superseded by #4395, stacked above #4394. Changes consolidated with published metric, dashboard and fault-test evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant