Skip to content

chore!: adopt log/slog, drop go-kit/log #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

tjhop
Copy link
Contributor

@tjhop tjhop commented Oct 14, 2024

The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

In addition to the parts that were straightforward conversions, this
also:

  • refactors much of the logging config to adopt slog
    • removed custom logger.go setup for go-kit
    • adopt promslog/flag and use that to handle parsing log
      level/format flags
    • for consistent behavior, keep log output flag to allow toggle
      stdout/stderr for output
    • adopt promslog for logger setup
  • enables sloglint in golangci-lint config
  • drops go-kit/log exclusions from lint config
  • tidies mods to drop go-kit/log and go-logfmt/logfmt deps

@tjhop
Copy link
Contributor Author

tjhop commented Oct 14, 2024

cc: @SuperQ

@SuperQ
Copy link
Contributor

SuperQ commented Oct 16, 2024

Same here, just needs a rebase for the linter.

tjhop added 4 commits October 17, 2024 09:23
The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

In addition to the parts that were straightforward conversions, this
also:
- refactors much of the logging config to adopt slog
    - removed custom `logger.go` setup for go-kit
    - adopt promslog/flag and use that to handle parsing log
      level/format flags
    - for consistent behavior, keep log output flag to allow toggle
      stdout/stderr for output
    - adopt promslog for logger setup
- enables sloglint in golangci-lint config
- drops go-kit/log exclusions from lint config
- tidies mods to drop go-kit/log and go-logfmt/logfmt deps

Signed-off-by: TJ Hoplock <[email protected]>
Fixes:

```
WARN [config_reader] The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.
```

Signed-off-by: TJ Hoplock <[email protected]>
@tjhop
Copy link
Contributor Author

tjhop commented Oct 17, 2024

Rebased 👍

@sysadmind sysadmind self-requested a review October 17, 2024 15:48
@sysadmind sysadmind self-assigned this Oct 17, 2024
Copy link
Contributor

@sysadmind sysadmind left a comment

Choose a reason for hiding this comment

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

LGTM

@sysadmind sysadmind merged commit 7a09a84 into prometheus-community:master Oct 17, 2024
4 checks passed
sysadmind added a commit to sysadmind/elasticsearch_exporter that referenced this pull request Oct 17, 2024
- Update README to include section about configuring the logging settings.
- Update CHANGELOG with information about breaking changes in the logging output from prometheus-community#942.

Signed-off-by: Joe Adams <[email protected]>
sysadmind added a commit that referenced this pull request Oct 17, 2024
- Update README to include section about configuring the logging settings.
- Update CHANGELOG with information about breaking changes in the logging output from #942.

Signed-off-by: Joe Adams <[email protected]>
rtkkroland pushed a commit to rtkwlf/elasticsearch_exporter that referenced this pull request Jan 28, 2025
The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

In addition to the parts that were straightforward conversions, this
also:
- refactors much of the logging config to adopt slog
    - removed custom `logger.go` setup for go-kit
    - adopt promslog/flag and use that to handle parsing log
      level/format flags
    - for consistent behavior, keep log output flag to allow toggle
      stdout/stderr for output
    - adopt promslog for logger setup
- enables sloglint in golangci-lint config
- drops go-kit/log exclusions from lint config
- tidies mods to drop go-kit/log and go-logfmt/logfmt deps

Signed-off-by: TJ Hoplock <[email protected]>

* ci: update deprecated golangci-lint config

Fixes:

```
WARN [config_reader] The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.
```

Signed-off-by: TJ Hoplock <[email protected]>

---------

Signed-off-by: TJ Hoplock <[email protected]>
rtkkroland pushed a commit to rtkwlf/elasticsearch_exporter that referenced this pull request Jan 28, 2025
…#945)

- Update README to include section about configuring the logging settings.
- Update CHANGELOG with information about breaking changes in the logging output from prometheus-community#942.

Signed-off-by: Joe Adams <[email protected]>
SuperQ added a commit that referenced this pull request Feb 26, 2025
BREAKING CHANGES:

The flag `--es.slm` has been renamed to `--collector.slm`.

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 bewen replaced with `time`, the accuracy is less, and the timezone is not forced to UTC. The `caller` field has been replaced by the `source` field, which now includes the full path to the source file. The `level` field now exposes the log level in capital letters.

* [CHANGE] Rename --es.slm to --collector.slm #932
* [CHANGE] Replace logging system #942
* [ENHANCEMENT] Add external refresh stats #933

Signed-off-by: SuperQ <[email protected]>
@SuperQ SuperQ mentioned this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants