Skip to content

Update to latest Prometheus dependencies#225

Merged
blkperl merged 3 commits intoLusitaniae:masterfrom
dswarbrick:update-deps
Sep 19, 2024
Merged

Update to latest Prometheus dependencies#225
blkperl merged 3 commits intoLusitaniae:masterfrom
dswarbrick:update-deps

Conversation

@dswarbrick
Copy link
Copy Markdown
Contributor

@dswarbrick dswarbrick commented Sep 19, 2024

Update client_golang, common and exporter-toolkit dependencies. Migrate logging to Go standard library log/slog, as required by exporter-toolkit v0.13.0+.

Supersedes: #220
Supersedes: #221
Supersedes: #222

prometheus/common removed the version.NewCollector() function, which is
now supplied by prometheus/client_golang (since v1.19.0).

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
The Prometheus ecosystem is moving away from go-kit/log, and instead
adopting the Go standard library log/slog.

prometheus/exporter-toolkit v0.13.0 introduced a
non-backwards-compatible change, requiring exporters to supply a
*slog.Logger to the web.ListenAndServe() function.

The end-user changes are minimal. Logging is still in logfmt by default,
albeit with some minor changes:
- "ts" (timestamp) field is now "time", and expressed in local time with
  timezone offset (previously it was UTC)
- "caller" field is replaced by "source", which is also now more
  verbose, with a fully qualified path
- "level" field values are now capitalized, e.g. "INFO"

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Some leftover cruft from pre-structured-logging which used a Sprintf,
resulted in unpopulated verb in message:
 msg="caught sig: %+v. Wait 2 seconds..."

Since the signal is explicitly included as a logfmt field, the message
can be simplified.

Demote the "Listening and waiting ..." message to debug, since
exporter-toolkit already logs that is listening.

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Copy link
Copy Markdown
Collaborator

@blkperl blkperl left a comment

Choose a reason for hiding this comment

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

Thanks!

@blkperl blkperl merged commit 24b33e8 into Lusitaniae:master Sep 19, 2024
@dswarbrick dswarbrick deleted the update-deps branch September 19, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants