From c9e0e36701bcd1a7a6ccc372834e227fda31e616 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 26 Sep 2025 16:33:09 +0200 Subject: [PATCH] Add comments clarifying why promql.Querylogger exists (#17231) And why we only have one implementation in this code base. Fixes: https://github.com/prometheus/prometheus/issues/15869 Signed-off-by: Jan Fajerski --- promql/engine.go | 2 ++ util/logging/file.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/promql/engine.go b/promql/engine.go index 58ba482c45..31d910da9a 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -125,6 +125,8 @@ var _ QueryLogger = (*logging.JSONFileLogger)(nil) // QueryLogger is an interface that can be used to log all the queries logged // by the engine. +// logging.JSONFileLogger implements this interface, downstream users may use +// different implementations. type QueryLogger interface { slog.Handler io.Closer diff --git a/util/logging/file.go b/util/logging/file.go index 3f97b17f09..5e379442a2 100644 --- a/util/logging/file.go +++ b/util/logging/file.go @@ -27,8 +27,8 @@ var _ slog.Handler = (*JSONFileLogger)(nil) var _ io.Closer = (*JSONFileLogger)(nil) -// JSONFileLogger represents a logger that writes JSON to a file. It implements -// the slog.Handler interface, as well as the io.Closer interface. +// JSONFileLogger represents a logger that writes JSON to a file. +// It implements the promql.QueryLogger interface. type JSONFileLogger struct { handler slog.Handler file *os.File