* chore!: adopt log/slog, drop go-kit/log
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
This commit includes several changes:
- bump exporter-tookit to v0.13.1 for log/slog support
- updates golangci-lint deprecated configs
- enables sloglint linter
- removes old go-kit/log linter configs
- introduce some `if logger == nil { $newLogger }` additions to prevent
nil references
- converts cluster membership config to use a stdlib compatible slog
adapter, rather than creating a custom io.Writer for use as the
membership `logOutput` config
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
* chore: address PR feedback
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
---------
Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
* fix: close SMTP submission correctly to handle errors
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
* lint
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
* comments
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
---------
Signed-off-by: Danny Kopping <dannykopping@gmail.com>
* Add godot linter
Signed-off-by: George Robinson <george.robinson@grafana.com>
* Remove extra line from LICENSE
Signed-off-by: George Robinson <george.robinson@grafana.com>
---------
Signed-off-by: George Robinson <george.robinson@grafana.com>
We don't need to test `getPassword()` separately as it can be covered
with the tests already checking the various authentication methods.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* SMTP config: add global and local password file fields
Add config fields (for both global email config and route-specific email
config) that specify path to file containing SMTP password. We don't
want the password in the config file itself, and reading the password
from a k8s-secret-backed file keeps the password itself "encrypted at
rest" in etcd, and cleanly separated from the rest of the AM config.
I used the same approach as pull request #2534 "Add support to set the
Slack URL in the file"
<https://github.com/prometheus/alertmanager/pull/2534/files> in the
upstream repo.
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* changed *AuthPasswordFile field types to string per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added error to getPassword() retval per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* simplified conf.smtp-* files
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* update docs to reflect field type change
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* don't treat username-without-password as invalid
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* test cleanup
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* Apply suggestions from code review
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
* Updated per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added sub-test per review feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* added test on Email.getPassword() per feedback
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* only inherit global SMTP passwords if neither local password field is set
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
* removed blank line caught by gofumpt
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <eric.rath@oracle.com>
Signed-off-by: Eric R. Rath <4080262+ericrrath@users.noreply.github.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
* notify/email: wrap all errors for easier debugging
In addition, this commit passes the current context to the TCP dialer
and it doesn't log any QUIT errors if the email delivery wasn't
successful.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix typo
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Instead of keeping all notifiers in the notify package, it splits them
into individual sub-packages. This improves readability and
maintainability of the code.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>