When WithHTTPKeyFunc or WithGRPCKeyFunc is configured to bucket by endpoint (e.g. by path or gRPC method), minDelay and warmupDelay remain global across all keys.
This creates a mismatch for services with heterogeneous endpoint latencies. For example, if /api/fast has a p90 of 2ms and /api/slow has a p90 of 800ms, a global warmupDelay=10ms is appropriate for the former but causes near-constant hedging during warmup for the latter.
Proposed solution (open for discussion)
Option 1: allow the key function to return structured config alongside the key:
WithHTTPKeyFunc(func(r *http.Request) (key string, overrides ...Option) { ... })
Option 2: a separate WithPerKeyDefaults map or a second option that accepts a function func(key string) []Option.
Context
Raised by @qualidafial in #4. Deliberately deferred from that PR to keep scope focused on the key function feature itself.
When
WithHTTPKeyFuncorWithGRPCKeyFuncis configured to bucket by endpoint (e.g. by path or gRPC method),minDelayandwarmupDelayremain global across all keys.This creates a mismatch for services with heterogeneous endpoint latencies. For example, if
/api/fasthas a p90 of 2ms and/api/slowhas a p90 of 800ms, a globalwarmupDelay=10msis appropriate for the former but causes near-constant hedging during warmup for the latter.Proposed solution (open for discussion)
Option 1: allow the key function to return structured config alongside the key:
WithHTTPKeyFunc(func(r *http.Request) (key string, overrides ...Option) { ... })Option 2: a separate
WithPerKeyDefaultsmap or a second option that accepts a functionfunc(key string) []Option.Context
Raised by @qualidafial in #4. Deliberately deferred from that PR to keep scope focused on the key function feature itself.