prometheus/scrape
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
..
testdata Include test CA text info (#14699) 2024-08-20 19:41:02 +02:00
clientprotobuf.go lint: Revamp our linting rules, mostly around doc comments 2024-08-22 17:36:11 +02:00
helpers_test.go TSDB: Fix some edge cases when OOO is enabled (#14710) 2024-10-23 17:34:28 +02:00
manager.go ref: JSONFileLogger slog handler, add scrape.FailureLogger interface 2024-11-28 23:14:31 -05:00
manager_test.go enable errorf rule from perfsprint linter 2024-11-06 16:50:36 +01:00
metrics.go Scraping: add metric for symbol table size 2024-07-05 10:16:22 +01:00
scrape.go ref: JSONFileLogger slog handler, add scrape.FailureLogger interface 2024-11-28 23:14:31 -05:00
scrape_test.go ref: JSONFileLogger slog handler, add scrape.FailureLogger interface 2024-11-28 23:14:31 -05:00
target.go Remove no-default-scrape-port featureFlag 2024-09-25 10:13:19 -05:00
target_test.go Remove no-default-scrape-port featureFlag 2024-09-25 10:13:19 -05:00