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 <jfajersk@redhat.com>
This commit is contained in:
Jan Fajerski 2025-09-26 16:33:09 +02:00 committed by GitHub
parent e697dfa3ff
commit c9e0e36701
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -125,6 +125,8 @@ var _ QueryLogger = (*logging.JSONFileLogger)(nil)
// QueryLogger is an interface that can be used to log all the queries logged // QueryLogger is an interface that can be used to log all the queries logged
// by the engine. // by the engine.
// logging.JSONFileLogger implements this interface, downstream users may use
// different implementations.
type QueryLogger interface { type QueryLogger interface {
slog.Handler slog.Handler
io.Closer io.Closer

View File

@ -27,8 +27,8 @@ var _ slog.Handler = (*JSONFileLogger)(nil)
var _ io.Closer = (*JSONFileLogger)(nil) var _ io.Closer = (*JSONFileLogger)(nil)
// JSONFileLogger represents a logger that writes JSON to a file. It implements // JSONFileLogger represents a logger that writes JSON to a file.
// the slog.Handler interface, as well as the io.Closer interface. // It implements the promql.QueryLogger interface.
type JSONFileLogger struct { type JSONFileLogger struct {
handler slog.Handler handler slog.Handler
file *os.File file *os.File