Queue size variables#59
Conversation
|
To be honest, I'm not familiar in nginx module development and this PR was fully vibecoded with claude. |
Architectural Alternative: Status HandlerExposing global shared-memory state via per-request variables can be risky. Recommendation: Instead of variables, consider implementing a dedicated status handler (similar to Benefits: This allows external monitoring tools (like Prometheus or Datadog) to scrape the queue metrics at a fixed interval (e.g., every 5 seconds) rather than forcing NGINX to calculate and log the data for every single request. This keeps the request path clean and provides the same level of observability. Status-handler shape is cleaner for production observability. NGINX’s own So the best compromise is probably: keep the variables for ad hoc debugging, but add a dedicated status endpoint for real monitoring. That keeps the request path simple while still giving operators the visibility they need. Also, the fact that NGINX modules commonly register embedded variables during module init, like |
506953a to
b63e1f9
Compare
|
imho variables are more flexible as they can be used in own handlers, like basic |
b63e1f9 to
506953a
Compare
…variables Register two read-only nginx variables via postconfiguration hook: - $cache_purge_queue_size: live atomic read of queue->size - $cache_purge_queue_max_size: plain read of queue->max_size (immutable) Both return "-" when background purge is disabled. Covered by tests 7 and 8 in t/background_queue.t.
506953a to
be59e9e
Compare
Added $cache_purge_queue_size/$cache_purge_queue_max_size to track queue size in logs or metrics.