mirror of
https://github.com/openfaas/faas.git
synced 2025-06-20 13:06:40 +00:00
Add Concurrency Limiter
This enables limiting concurrency. It is a naive approach which will reject requests as soon as they exceed the maximum number of in-flight requests. It is a port of the following PR from the new watchdog code: https://github.com/openfaas-incubator/of-watchdog/pull/54 Signed-off-by: Sargun Dhillon <sargun@sargun.me> Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
45cf4db4cb
commit
b019f6ca54
@ -59,7 +59,7 @@ func (m *MetricsServer) Serve(cancel chan bool) {
|
||||
|
||||
// InstrumentHandler returns a handler which records HTTP requests
|
||||
// as they are made
|
||||
func InstrumentHandler(next http.HandlerFunc, _http Http) http.HandlerFunc {
|
||||
func InstrumentHandler(next http.Handler, _http Http) http.HandlerFunc {
|
||||
return promhttp.InstrumentHandlerCounter(_http.RequestsTotal,
|
||||
promhttp.InstrumentHandlerDuration(_http.RequestDurationHistogram, next))
|
||||
}
|
||||
|
Reference in New Issue
Block a user