func (m requestTreeMiddleware) ProcessServerRequest(req mercury.Request) (mercury.Request, mercury.Response) { req.SetContext(context.WithValue(req.Context(), reqIdCtxKey, req.Id())) if v := req.Headers()[parentIdHeader]; v != "" { req.SetContext(context.WithValue(req.Context(), parentIdCtxKey, v)) } // Set the current service and endpoint into the context req.SetContext(context.WithValue(req.Context(), currentServiceHeader, req.Service())) req.SetContext(context.WithValue(req.Context(), currentEndpointHeader, req.Endpoint())) // Set the originator into the context req.SetContext(context.WithValue(req.Context(), originServiceHeader, req.Headers()[originServiceHeader])) req.SetContext(context.WithValue(req.Context(), originEndpointHeader, req.Headers()[originEndpointHeader])) return req, nil }