Add span RPCServer.ServeHTTP
This commit is contained in:
parent
d51fbcc9c5
commit
42a883777c
|
@ -89,6 +89,10 @@ func NewRPCServer(logger logr.Logger,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (server *RPCServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (server *RPCServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
|
ctx, span := tracer.Start(r.Context(), "RPCServer.ServeHTTP")
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/text; charset=utf-8")
|
w.Header().Set("Content-Type", "application/text; charset=utf-8")
|
||||||
|
|
||||||
canGzip := strings.Contains(r.Header.Get("Accept-Encoding"), "gzip")
|
canGzip := strings.Contains(r.Header.Get("Accept-Encoding"), "gzip")
|
||||||
|
@ -111,7 +115,7 @@ func (server *RPCServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
logger = logger.WithValues("uid", reqId.String())
|
logger = logger.WithValues("uid", reqId.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
result := server.serveRequest(r.Context(), logger, payload, cltVersion, cltPlatform, cltIP)
|
result := server.serveRequest(ctx, logger, payload, cltVersion, cltPlatform, cltIP)
|
||||||
|
|
||||||
server.writeResponse(canGzip, w, result.Payload)
|
server.writeResponse(canGzip, w, result.Payload)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue