Changed var name.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
This commit is contained in:
Peter Štibraný 2020-02-18 16:22:26 +01:00
parent 318cd413fc
commit baa6f60384

View File

@ -34,23 +34,23 @@ func ContextWithPath(ctx context.Context, path string) context.Context {
// ContextFromRequest returns a new context from a requests with identifiers of
// the request to be used later when logging the query.
func ContextFromRequest(ctx context.Context, r *http.Request) context.Context {
m := map[string]string{
reqCtxVal := map[string]string{
"method": r.Method,
}
// r.RemoteAddr has no defined format, so don't return error if we cannot split it into IP:Port.
ip, _, _ := net.SplitHostPort(r.RemoteAddr)
if ip != "" {
m["clientIP"] = ip
reqCtxVal["clientIP"] = ip
}
var path string
if v := ctx.Value(pathParam); v != nil {
path = v.(string)
m["path"] = path
reqCtxVal["path"] = path
}
return promql.NewOriginContext(ctx, map[string]interface{}{
"httpRequest": m,
"httpRequest": reqCtxVal,
})
}