Skip to content

Conversation

@woblerr
Copy link
Owner

@woblerr woblerr commented May 11, 2025

Bumped github.com/prometheus/exporter-toolkit to v0.14.0.
Bumped github.com/prometheus/common to v0.63.0.
Bumped github.com/prometheus/client_golang to v1.20.4.
Dropped dependencies for go-kit/log and go-logfmt/logfmt. Updated other dependencies.

The logging system has been replaced with log/slog from the stdlib. This change is being made across the prometheus ecosystem. The logging output has changed, but the messages and levels remain the same. The ts label for the timestamp has between replaced with time. The caller field has been replaced by the source field. The level field now exposes the log level in capital letters.

Old log format example:

ts=2025-05-11T13:09:05.384Z caller=pgbackrest_exporter.go:97 level=info msg="Starting exporter" name=pgbackrest_exporter version=0.19.0
ts=2025-05-11T13:09:05.385Z caller=pgbackrest_exporter.go:154 level=info mgs="Use exporter parameters" endpoint=/metrics config.file=
ts=2025-05-11T13:09:05.388Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9854
ts=2025-05-11T13:09:05.388Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9854

New log format example:

time=2025-05-11T13:32:54.939Z level=INFO source=pgbackrest_exporter.go:96 msg="Starting exporter" name=pgbackrest_exporter version=unknown
time=2025-05-11T13:32:54.940Z level=INFO source=pgbackrest_exporter.go:153 msg="Use exporter parameters" endpoint=/metrics config.file=""
time=2025-05-11T13:32:54.943Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9854
time=2025-05-11T13:32:54.943Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9854

See prometheus/exporter-toolkit#240 and prometheus/common#677.

Bump github.com/prometheus/exporter-toolkit to v0.14.0.
Bump github.com/prometheus/common to v0.63.0.
Bump github.com/prometheus/client_golang to v1.20.4.
Drops deps for go-kit/log and go-logfmt/logfmt. Update other deps.

The logging system has been replaced with log/slog from the stdlib.  This change is being made across the prometheus ecosystem. The logging output has changed, but the messages and levels remain the same. The ts label for the timestamp has between replaced with time. The caller field has been replaced by the source field. The level field now exposes the log level in capital letters.

See prometheus/exporter-toolkit#240 and prometheus/common#677.
@woblerr woblerr self-assigned this May 11, 2025
@woblerr woblerr added enhancement dependencies Pull requests that update a dependency file labels May 11, 2025
@woblerr woblerr requested a review from Copilot May 11, 2025 13:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces the legacy go-kit/log logging system with the stdlib log/slog while updating several dependency versions. Key changes include switching all logger interfaces from go-kit/log to slog, updating logger method invocations throughout the code and tests, and bumping dependency versions in go.mod.

Reviewed Changes

Copilot reviewed 337 out of 337 changed files in this pull request and generated no comments.

File Description
pgbackrest_exporter.go Migrated logging calls to slog and updated logger parameter types.
go.mod Dependency versions bumped and unused logging packages removed.
Multiple backrest/*.go and corresponding tests Replaced go-kit/log with slog across exporter, metrics, and test files.
Comments suppressed due to low confidence (3)

pgbackrest_exporter.go:31

  • The update to using *slog.Logger in the API is effective, but please ensure that all interface contracts and concurrent usages are properly reviewed to avoid any race conditions in production.
func StartPromEndpoint(logger *slog.Logger) {

backrest/backrest_wal_metrics_test.go:332

  • Verify that the expectation of uppercase log level strings (e.g. "level=ERROR") is consistent across all tests and logging configurations in the new slog setup.
errorsOutputCount := strings.Count(out.String(), "level=ERROR")

pgbackrest_exporter.go:80

  • Ensure that the formatting and structure of slog log messages, which now output key values in uppercase by default, are consistently handled and parsed across the system, especially in log monitoring setups.
logger.Error("Get data from pgBackRest failed", "err", err)

@woblerr woblerr merged commit 25305b5 into master May 11, 2025
5 checks passed
@woblerr woblerr deleted the bump_exporter_toolkit branch May 11, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants