prometheus/util
TJ Hoplock e0104a6b7e ref: JSONFileLogger slog handler, add scrape.FailureLogger interface
Improves upon #15434, better resolves #15433.

This commit introduces a few changes to ensure safer handling of the
JSONFileLogger:
- the JSONFileLogger struct now implements the slog.Handler interface,
  so it can directly be used to create slog Loggers. This pattern more
closely aligns with upstream slog usage (which is generally based around
handlers), as well as making it clear that devs are creating a whole new
logger when interacting with it (vs silently modifying internal configs
like it did previously).
- updates the `promql.QueryLogger` interface to be a union of the
  methods of both the `io.Closer` interface and the `slog.Handler`
interface. This allows for plugging in/using slog-compatible loggers
other than the JSONFileLogger, if desired (ie, for downstream projects).
- introduces new `scrape.FailureLogger` interface; just like
  `promql.QueryLogger`, it is a union of `io.Closer` and `slog.Handler`
interfaces. Similar logic applies to reasoning.
- updates tests where needed; have the `FakeQueryLogger` from promql's
  engine_test implement the `slog.Handler`, improve JSONFileLogger test
suite, etc.

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-11-28 23:14:31 -05:00
..
almost [COMMENT] Improve comment on almost.Equal; add tests 2024-08-30 10:13:00 +01:00
annotations [BUGFIX] PromQL: Corrects the behaviour of some operator and aggregators with Native Histograms (#15245) 2024-11-12 15:37:05 +01:00
convertnhcb Set hasCount after setting count to be consistent 2024-11-26 13:56:22 +01:00
documentcli Add support for multiple listening addresses 2024-08-20 13:09:16 +02:00
fmtutil chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
gate Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
httputil golangci-lint: enable usestdlibvars linter 2024-04-08 19:26:23 +00:00
jsonutil Name float values as "floats", not as "values" 2023-04-13 19:25:24 +02:00
junitxml promtool: JUnit-Format XML Test Results (#14506) 2024-07-29 21:28:08 +10:00
logging ref: JSONFileLogger slog handler, add scrape.FailureLogger interface 2024-11-28 23:14:31 -05:00
netconnlimit Add support for multiple listening addresses 2024-08-20 13:09:16 +02:00
notifications Move notifications in utils 2024-10-04 10:11:56 +02:00
osutil
pool Move packages out of deprecated pkg directory 2021-11-09 08:03:10 +01:00
runtime chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00
runutil Append Created Timestamps (#12733) 2023-12-11 08:43:42 +00:00
stats Move from golang.org/x/exp/slices into slices now that we only support Go >= 1.21 2024-02-28 14:54:53 +01:00
strutil Implement SanitizeLabelName and Full variant 2023-02-03 15:28:33 +00:00
teststorage TSDB: Fix some edge cases when OOO is enabled (#14710) 2024-10-23 17:34:28 +02:00
testutil chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
treecache chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
zeropool chore: Fix typos (#14868) 2024-09-10 22:32:03 +02:00