From 5f04c699d57d93c0d40ae449140c25bf0c3a628d Mon Sep 17 00:00:00 2001 From: Muki Kiboigo Date: Thu, 17 Sep 2026 20:36:41 -0700 Subject: [PATCH] add robots evicted metric --- src/Metrics.zig | 2 ++ src/network/Robots.zig | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Metrics.zig b/src/Metrics.zig index 38f77323f..c7dabee96 100644 --- a/src/Metrics.zig +++ b/src/Metrics.zig @@ -92,6 +92,7 @@ http_navigation_delay_ms: Histogram(&.{ }) = .{}, robots_status: CounterEnum("category", @import("network/http.zig").StatusCategory) = .{}, robots_access: CounterEnum("result", enum { allow, deny }) = .{}, +robots_evictions: Counter = .{}, cors_check: CounterEnum("result", enum { same_origin, no_cors, simple, preflight }) = .{}, cors_preflight: CounterEnum("result", enum { allowed, blocked }) = .{}, cors_response: CounterEnum("result", enum { allowed, blocked }) = .{}, @@ -130,6 +131,7 @@ const help = .{ .http_navigation_delay_ms = "Time in milliseconds a throttled top-level navigation waited", .robots_status = "robots.txt response status", .robots_access = "robots.txt result", + .robots_evictions = "robots.txt cache entries evicted to stay within limit", .cors_check = "CORS initial classification: same_origin/no_cors need no CORS handling, simple needs response validation only, preflight needs an OPTIONS round-trip first", .cors_preflight = "CORS preflight (OPTIONS) results, one per request that required one", .cors_response = "CORS actual-response validation results", diff --git a/src/network/Robots.zig b/src/network/Robots.zig index 38122c421..b1fe63b40 100644 --- a/src/network/Robots.zig +++ b/src/network/Robots.zig @@ -233,6 +233,7 @@ pub const RobotStore = struct { if (try self.evictions.insert(gop.key_ptr.*)) |evict_key| { if (self.map.fetchRemove(evict_key)) |kv| { + lp.metrics.robots_evictions.incr(); self.allocator.free(kv.key); var entry = kv.value; self.freeEntry(&entry);