mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-10-20 05:56:56 +00:00
feat(admin): add events feed, fleet-wide rejections and span rankings
GET /admin/api/events returns recent failures, newest first. It covers rate limits, budget and unpriced-model refusals, upstream errors, timeouts and capacity rejections. Events go into an in-process ring of 200 entries and are copied to a Redis list (llmgw:events, LPUSH plus LTRIM to 200). The copy happens only on the error path, is throttled to 50 per second per replica, and never blocks a request. When Redis is absent or down, the feed falls back to this replica's ring. Messages are fixed strings or scrubbed provider errors. Fields are assigned one at a time, because Yaegi drops values from a multi-value assignment that contains a call. Rejections per day are counted per scope and in total, in the same store call that already rolls back a rejected request. /admin/api/usage returns them as rejectionsPerDay. /admin/api/usage/models accepts span, which sums that many buckets, and prefix, which filters model ids before the limit applies. The overview reports the replica id, the instance name and the warnings logged while the middleware was built. The failover and retry fan-out warning is now logged at WARN. Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
This commit is contained in:
@@ -351,10 +351,13 @@ func (c *respClient) pipelineEncoded(payload []byte, n int, mutates bool) ([]any
|
||||
// INCRBYFLOAT is not currently sent by this client (only INCRBY is —
|
||||
// redis_store.go), but is listed for the same reason INCRBY is: an
|
||||
// operator or a future caller adding it must not have to rediscover this
|
||||
// gate.
|
||||
// gate. LPUSH (events.go's eventLog.push, F3 v0.3 dashboard task) joins
|
||||
// the same list for the identical reason: replaying it after an ambiguous
|
||||
// failure could push the same event twice.
|
||||
var pipelineMutatingCommands = map[string]bool{
|
||||
"INCRBY": true,
|
||||
"INCRBYFLOAT": true,
|
||||
"LPUSH": true,
|
||||
}
|
||||
|
||||
// pipelineMutates reports whether any command in cmds is one of
|
||||
|
||||
Reference in New Issue
Block a user