From 42a883777c517b6afebe780ce2e80de0a1aa1f76 Mon Sep 17 00:00:00 2001 From: Vladislav Veselskiy Date: Mon, 15 Apr 2024 11:49:11 +0300 Subject: [PATCH] Add span RPCServer.ServeHTTP --- server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server.go b/server.go index 4025014..63e8784 100644 --- a/server.go +++ b/server.go @@ -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) }