mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Changed var name.
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
This commit is contained in:
parent
318cd413fc
commit
baa6f60384
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue