mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Add x-duration-seconds for all functions via watchdog
This commit is contained in:
@ -42,6 +42,8 @@ func debugHeaders(source *http.Header, direction string) {
|
||||
}
|
||||
|
||||
func pipeRequest(config *WatchdogConfig, w http.ResponseWriter, r *http.Request) {
|
||||
startTime := time.Now()
|
||||
|
||||
parts := strings.Split(config.faasProcess, " ")
|
||||
|
||||
if config.debugHeaders {
|
||||
@ -103,6 +105,9 @@ func pipeRequest(config *WatchdogConfig, w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
}
|
||||
|
||||
execTime := time.Since(startTime).Seconds()
|
||||
w.Header().Set("X-Duration-Seconds", fmt.Sprintf("%f", execTime))
|
||||
|
||||
w.WriteHeader(200)
|
||||
w.Write(out)
|
||||
|
||||
|
Reference in New Issue
Block a user