From f9730676d9f6db7c28b88b294aff8c628a8b5faa Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Thu, 8 Dec 2022 13:07:30 -0800 Subject: [PATCH] app/vmselect/searchutils: do not print flag name responsible for query timeout if the timeout isn't reached This should make the log message more clear --- app/vmselect/searchutils/searchutils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmselect/searchutils/searchutils.go b/app/vmselect/searchutils/searchutils.go index de971811c5..c830d2c79b 100644 --- a/app/vmselect/searchutils/searchutils.go +++ b/app/vmselect/searchutils/searchutils.go @@ -209,7 +209,7 @@ func (d *Deadline) String() string { startTime := time.Unix(int64(d.deadline), 0).Add(-d.timeout) elapsed := time.Since(startTime) msg := fmt.Sprintf("%.3f seconds (elapsed %.3f seconds)", d.timeout.Seconds(), elapsed.Seconds()) - if d.flagHint != "" { + if float64(elapsed)/float64(d.timeout) > 0.9 && d.flagHint != "" { msg += fmt.Sprintf("; the timeout can be adjusted with `%s` command-line flag", d.flagHint) } return msg