diff --git a/internal/handlers/admin/templates/index.html.tmpl b/internal/handlers/admin/templates/index.html.tmpl index c64e578..ff8c03f 100644 --- a/internal/handlers/admin/templates/index.html.tmpl +++ b/internal/handlers/admin/templates/index.html.tmpl @@ -27,6 +27,10 @@ Hits {{ .MiddlewareStats.CacheHits.Load }} + + Revalidated + {{ .MiddlewareStats.Revalidated.Load }} + Misses {{ .MiddlewareStats.CacheMisses.Load }} diff --git a/internal/middleware/middleware.go b/internal/middleware/middleware.go index 87c5064..b622761 100644 --- a/internal/middleware/middleware.go +++ b/internal/middleware/middleware.go @@ -59,6 +59,8 @@ func newLoggingMiddleware( case "miss": statistics.CacheMisses.Add(1) statistics.BytesDownloaded.Add(uint64(size)) + case "revalidated": + statistics.Revalidated.Add(1) default: panic("Unexpected cache state: " + cacheState) } diff --git a/internal/middleware/statistics.go b/internal/middleware/statistics.go index 7b12e4a..988a70c 100644 --- a/internal/middleware/statistics.go +++ b/internal/middleware/statistics.go @@ -15,6 +15,7 @@ type Statistics struct { CacheHits atomic.Uint64 CacheMisses atomic.Uint64 UnCacheable atomic.Uint64 + Revalidated atomic.Uint64 BytesServed atomic.Uint64 BytesDownloaded atomic.Uint64 }