From e72ccc9239ef6385c05cd8e6b0ec52bdf72b5e22 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Wed, 18 Nov 2020 20:37:54 +0200 Subject: [PATCH] app/vmselect: add remoteAddr to slow query log in order to improve debuggability This will simplify identifying the client that sends slow queries to VictoriaMetrics. --- app/vmselect/promql/exec.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmselect/promql/exec.go b/app/vmselect/promql/exec.go index a676c6cbe7..79df6bb841 100644 --- a/app/vmselect/promql/exec.go +++ b/app/vmselect/promql/exec.go @@ -33,8 +33,8 @@ func Exec(ec *EvalConfig, q string, isFirstPointOnly bool) ([]netstorage.Result, defer func() { d := time.Since(startTime) if d >= *logSlowQueryDuration { - logger.Warnf("slow query according to -search.logSlowQueryDuration=%s: duration=%.3f seconds, start=%d, end=%d, step=%d, accountID=%d, projectID=%d, query=%q", - *logSlowQueryDuration, d.Seconds(), ec.Start/1000, ec.End/1000, ec.Step/1000, ec.AuthToken.AccountID, ec.AuthToken.ProjectID, q) + logger.Warnf("slow query according to -search.logSlowQueryDuration=%s: remoteAddr=%s, duration=%.3f seconds, start=%d, end=%d, step=%d, accountID=%d, projectID=%d, query=%q", + *logSlowQueryDuration, ec.QuotedRemoteAddr, d.Seconds(), ec.Start/1000, ec.End/1000, ec.Step/1000, ec.AuthToken.AccountID, ec.AuthToken.ProjectID, q) slowQueries.Inc() } }()