Repository navigation
Separate artifact and metadata cache metrics on /metrics and the analytics page - #463
abhinavgautam01 wants to merge 3 commits into
Conversation
andrew
left a comment
There was a problem hiding this comment.
Thanks, the split looks right and every call site is classified correctly. Two things before merging:
internal/server/analytics.go:217 runs GetMetadataCacheStats() (a full GROUP BY over metadata_cache) on every analytics page load, while the ticker in server.go runs the same query separately for the gauges. The artifact figures on the same page come from the s.ecoStats 60-second snapshot, and the README says the page and gauges read the same snapshot. Please put the metadata stats behind that snapshot (or a small one alongside it) and have both the page and updateMetadataCacheStats read from it.
deploy/grafana/git-pkgs-proxy.json: the headline hit-ratio stat (line 368) still pools artifact and metadata, which is the confusion #416 reported. Please filter it to kind="artifact" to match the analytics tile, and change the hit/miss rate panels (lines 984 and 996) to sum by (kind) so the two kinds show as separate series.
|
Thanks, both addressed:
Also merged main to resolve the conflicts. The new Arch database and signature hits and the Go sumdb tile hit read from the metadata cache, so they are now recorded as metadata hits. |
Closes #416
Problem
Metadata cache hits were recorded in
proxy_cache_hits_totalwith only anecosystemlabel, so they could not be told apart from artifact hits. Cache size and download totals only covered artifacts. On/ui/analyticsthe Runtime card's hit rate pooled both kinds while every figure above it described artifacts alone, which is the mismatch in the issue's screenshot.Changes
Metrics
proxy_cache_hits_totalkindlabel:artifactormetadataproxy_cache_misses_totalkindlabel:artifactormetadataproxy_metadata_cache_served_bytes_total{ecosystem}proxy_metadata_cache_size_bytes{ecosystem}proxy_metadata_cache_entries{ecosystem}RecordCacheHitandRecordCacheMissare replaced by one function per kind (RecordArtifactCacheHit,RecordMetadataCacheHitand so on), so a call site cannot pass an arbitrary label value.lookupMetadataand the stored-rewrite fast path inrewrite_cache.gometadata_cachetable on the same one-minute tick as the artifact gauges. Aliases such asgemandrubygemsshare a series and ecosystems that disappear are removed, matchingUpdateEcosystemStats.Analytics page
cache_metadatais off and reports a failed query rather than showing an empty cache.Docs
The README metrics table is updated. A short section explains the two caches and how to query each kind.
Compatibility
sum(...)queries working. Every query indeploy/grafana/git-pkgs-proxy.jsonalready aggregates withsum, so the dashboard keeps working unchanged.kind="artifact"would match the analytics page and I can add that here if wanted.proxy_cache_hits_total{ecosystem="npm"}, now return two series.Tests
GetMetadataCacheStatson an empty cache, alias merging and rows with no recorded size.kind.Recording metadata hits as artifact hits again makes both new metadata hit tests fail.
go build,go vet,golangci-lint(v2.13.1),go test -race ./...and Swagger regeneration all pass locally.