mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
14 lines
333 B
Go
14 lines
333 B
Go
package gotsrpc
|
|
|
|
import "net/http"
|
|
|
|
func InstrumentedService(middleware http.HandlerFunc, handleStats GoRPCCallStatsHandlerFun) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
*r = *RequestWithStatsContext(r)
|
|
middleware(w, r)
|
|
if stats, ok := GetStatsForRequest(r); ok {
|
|
handleStats(stats)
|
|
}
|
|
}
|
|
}
|