Skip to content

cache metrics: label origin duration by dispatch path - #4387

Closed
larry-dalmeida wants to merge 6 commits into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:cache-origin-dispatch-label
Closed

larry-dalmeida wants to merge 6 commits into
zalando:larry-almeida-zse-cache-timeouts-prfrom
larry-dalmeida:cache-origin-dispatch-label

Conversation

@larry-dalmeida

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

Copy link
Copy Markdown
Collaborator

Summary of changes

Adds a dispatch label (direct | pipeline) to skipper_cache_origin_duration_seconds, introduced in #4386.

In force mode with a static backend, cold-miss (coalesced) and revalidation origin fetches are dispatched directly and bypass Skipper's proxy pipeline. They are invisible to MeasureBackend* metrics and the access log, and cache.reval_backend_dispatch only counts revalidation. #4370 documents this gap; this PR makes the split observable per route and status class.

Label cardinality is bounded: dispatch has 2 values, so each existing series is at most doubled.

Docs (docs/operation/operation.md) and CONTEXT.md are updated.

Stacked PR: this targets larry-almeida-zse-cache-timeouts-pr, so the GitHub diff also contains the #4384/#4385/#4386 commits. Only the top commit (d767f636) is new; please review that commit. Merge after #4386.

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-4387 test -race -count=1 ./filters/cache -run '^(TestCacheOriginStatusClass|TestCacheRecordCacheControlBoundedLabels|TestCacheRecordCacheControlOncePerResponse|TestCacheFilterOriginMetrics|TestCacheRouteRevalDropped|TestCacheResponseOriginCacheControl|TestCacheRouteRevalFailurePaths|TestCacheRouteRevalTerminalOutcomes|TestCacheFilter_OriginDurationDispatch)$'
go -C ../skipper-pr-4387 test -race -count=1 ./metrics -run '^(TestPrometheusCacheRouteReval|TestPrometheusCacheOriginDurationRouteStatus|TestPrometheusCacheOriginCacheControl|TestPrometheusCacheOriginDuration)$'
go -C ../skipper-pr-4387 test -race -count=1 ./metrics/metricstest -run '^TestCacheOriginMockMetrics$'

Expected: 14 focused tests pass. All 30 observed origin-duration series were dispatch="direct" (force mode/static backend); allowed values: direct, pipeline. The histogram covers cold misses and refreshes; cache.reval_backend_dispatch counts refreshes only.

Checklist

  • Added regression tests and documentation.
  • Confirm CI passes on the current head.

Rollback Plan

Revert this PR; the metric returns to the route/status_class label set from #4386.

References & Additional Context

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>
- Route revalidation outcomes (started/success/failed/dropped)
- Origin fetch duration by route and status class
- Cache-Control directive tracking from origin responses

These metrics instrument cache operations across routes and origin interactions.

Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
Signed-off-by: Larry D Almeida <hello@larrydalmeida.com>
@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