Commit Graph

38 Commits

Author SHA1 Message Date
TJ Hoplock f6b942cf9b
chore!: adopt log/slog, drop go-kit/log (#4089)
* 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>
2024-11-06 09:09:57 +00:00
Emmanuel Lodovice 730bd752d1
Return error when TmplText errors in sns notifier (#3879)
* Return error when TmplText errors in sns notifier

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>

* Use fmt.Errorf instead of errors.Wrap

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>

---------

Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>
2024-06-17 09:44:11 +01:00
gotjosh 7e2cd80c2d
Revert "Return error when TmplText errors in sns notifier (#3531)" (#3876)
This reverts commit 603a72800e.
2024-06-14 10:27:32 +01:00
Emmanuel Lodovice 603a72800e
Return error when TmplText errors in sns notifier (#3531)
Signed-off-by: Emmanuel Lodovice <lodovice@amazon.com>
2024-06-13 08:21:49 +01:00
Matthieu MOREL b9e347b9d1 golangci-lint: enable testifylint linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-10 08:50:03 +00:00
Matthieu MOREL b81bad8711 use Go standard errors
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-08 16:44:13 +01:00
Yijie Qin 7923bc5f8e
add status code label to the numTotalFailedNotifications metric (#3094)
* add reason label to the numTotalFailedNotifications metric

Signed-off-by: Yijie Qin <qinyijie@amazon.com>
2023-02-03 12:09:21 +00:00
Matthias Loibl a6d10bd5bc
Update golangci-lint and fix complaints (#2853)
* Copy latest golangci-lint files from Prometheus

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Use grafana/regexp over stdlib regexp

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Fix typos in comments

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Fix goimports complains in import sorting

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* gofumpt all Go files

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Update naming to comply with revive linter

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* config: Fix error messages to be lower case

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* test/cli: Fix error messages to be lower case

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* .golangci.yaml: Remove obsolete space

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* config: Fix expected victorOps error

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Use stdlib regexp

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>

* Clean up Go modules

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
2022-03-25 17:59:51 +01:00
Simon Pasquier ce01a67b5a notify/sns: detect FIFO topic based on the rendered value
Since the TopicARN field is a template string, it's safer to check for
the ".fifo" suffix in the rendered string.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2022-01-21 17:16:06 +01:00
Julien Pivotto d59548fbab
Enable HTTP 2 again (#2720)
We are re-enabling HTTP 2 again. There has been a few bugfixes upstream
in go, and we have also enabled ReadIdleTimeout.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-11-10 17:28:47 +01:00
Marco Pracucci 8006780ce2
Fix HTTP client options in SNS receiver
Signed-off-by: Marco Pracucci <marco@pracucci.com>
2021-09-14 16:25:48 +02:00
Julien Pivotto b2a4cacb95 Update go dependencies & switch to go-kit/log
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-08-02 12:43:23 +02:00
Tyler Reid a1260af1c3 Break notify into submethods to create the session then create the publish input to send. Check we populate a region for all requests.
This reverts commit 4c2a5f156c.

Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-07-09 10:53:35 -05:00
Tyler Reid 077b20dd9a Add error check when creating sns session
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-07-01 09:19:25 -05:00
Tyler Reid 1322abdc08 Remove unused checkTopicFifoAttribute function
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-27 21:02:20 -05:00
Tyler Reid 208bed6dee Update config docs to clarify fifo SNS deduplication strategy. Remove extra api call get topic attributes and use '.fifo' strategy instead
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-27 20:26:44 -05:00
Tyler Reid bd82f70bc2 Fix spacing for client config
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-22 14:44:33 -05:00
Tyler Reid 30a83f7bf7 Use supplied user creds when creating an STS client
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-22 14:43:41 -05:00
Tyler Reid 9ff4ac3301 Create new session if needed to get STS Creds
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-21 13:41:53 -05:00
Tyler Reid dfb4d1fba1 Fix linter error
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-21 12:32:36 -05:00
Tyler Reid 8911051770 Make API URL optional, clear up credential logic
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-21 12:29:03 -05:00
Tyler Reid b9b53f172d Code review fixes
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-17 08:55:27 -05:00
Tyler Reid d4ff90b555 Add missing template for aws region
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-16 16:42:55 -05:00
Tyler Reid 3446b35272 Code review fixes: copy attributes, truncate all the messages, fix logging, remove api_version
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-16 14:27:19 -05:00
Tyler Reid 9d37d6cc44 More gofmt fixes
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-16 09:56:55 -05:00
Tyler Reid 756cddad9c Fix for golangci-lint warning
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-16 09:38:18 -05:00
Tyler Reid 6ada9a634d Cache fifo bool in the notifier
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-16 09:31:23 -05:00
Tyler Reid c48b54bdf8 Fix gosmpl linter issues
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 19:07:19 -05:00
Tyler Reid 889fa96439 Remove isFifoTopic test
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 18:18:19 -05:00
Tyler Reid b509a5bdbb Add subject template for subject field. Better check for supplied creds, use GetTopicAttributes to check fifo
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 17:24:52 -05:00
Tyler Reid 68fa1bf19f Add string length check to fifo check
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 09:46:07 -05:00
Tyler Reid af8406a920 Check error type before unpacking awserr.requestFailure
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-15 09:09:01 -05:00
Tyler Reid 6519c399b1 Add some tests for sns receiver
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-14 22:14:12 -05:00
Tyler Reid 72d63a5d72 Remove isFifo config option; use template strings; use retier; other code review comments
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-14 18:28:57 -05:00
Tyler Reid 009f8b17e9 Use 1024 rather than 1000 for KB size, fix target arn, handle large SMS messages correctly
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-14 10:21:33 -05:00
Tyler Reid 74d15273c0 Add support for role arn, truncation, dedupe key and env auth
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-11 16:21:15 -05:00
Tyler Reid 5dcf4f5f91 ARN Auth start
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-11 10:30:44 -05:00
Tyler Reid 19e74f9ce7 WIP - SNS receiver
Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
2021-06-09 21:14:07 -05:00