Repository navigation
feat: add OpenTelemetry metrics for validation result cache - #1936
Open
nissessenap wants to merge 3 commits into
Open
nissessenap wants to merge 3 commits into
nissessenap wants to merge 3 commits into
Conversation
nissessenap
force-pushed
the
metrics
branch
2 times, most recently
from
November 9, 2026 18:33
24f35dd to
c2a9cc6
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Edvin Norling <edvin.norling@kognic.com>
Add a package-level newResultCache func var in cmd/webhook so the admission test can wrap the real LRUCache with a spy that counts cache hits and misses, replacing the zap observer that grepped the "cache hit"/"cache miss" debug logs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Edvin Norling <edvin.norling@kognic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Edvin Norling <edvin.norling@kognic.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.
Summary
Depends on #1933, which this branch is stacked on. Only the top commit belongs to this PR.
Adds OpenTelemetry metrics so operators can check that the validation result cache is doing something. They use the global MeterProvider that knative
sharedmainsets up. Instrumentation scope isgithub.com/sigstore/policy-controller/pkg/webhook.policy_controller.cache.operationsresult:hit/misspolicy_controller.cache.writesresult:stored/skippedpolicy_controller.cache.entriespolicy_controller.cache.evictionsreason:purgeNotes:
entriesis read from the cache at collection time and leaves out expired entries.evictionsonly counts entries dropped by a config-change purge.LRUExpireCachehas no callback for entries evicted because the cache is full.otel.Handle.Since #2044, knative's
metrics-protocoldefaults tonone, so/metricson:9090is empty unlessconfig-observabilitysetsmetrics-protocol: prometheus. Verified in kind with that set:policy_controller_cache_operations_total{result="hit"},policy_controller_cache_entriesand the other metrics showed up and matched the admissions made.Release Note
Added OpenTelemetry metrics for the validation result cache:
policy_controller.cache.operations,.writes,.entriesand.evictions.Documentation
NONE
🤖 Generated with Claude Code