Add span RPCServer.ServeHTTP

This commit is contained in:
Владислав Весельский 2024-04-15 11:49:11 +03:00
parent d51fbcc9c5
commit 42a883777c
1 changed files with 5 additions and 1 deletions

View File

@ -89,6 +89,10 @@ func NewRPCServer(logger logr.Logger,
}
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")
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())
}
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)
}