Commit Graph

14 Commits

Author SHA1 Message Date
George Robinson dacbf0050b
#3513: TimeMuter returns the names of time intervals (#3791)
* TimeMuter returns the names of time intervals

This commit updates the TimeMuter interface to also return the names
of the time intervals that muted the alerts.

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-30 12:47:00 +01:00
George Robinson 342f6a599c
Add godot linter (#3613)
* 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>
2024-03-21 11:26:46 +00:00
gotjosh acb58400fd
Refactor: Move `inTimeIntervals` from `notify` to `timeinterval` (#3556)
* Refactor: Move `inTimeIntervals` from `notify` to `timeinterval`

There's absolutely no change of functionality here and I've expanded coverage for similar logic in both places.
---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-10-13 14:15:05 +01:00
Ben Ridley 33a0e77a71
Add timezone support to time intervals. (#2782)
* Add explicit UTC to time interval tests

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Add timezone support to time intervals

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Update time interval documentation with time zone info

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Refactor notification tests to test timezone support

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Make use of Local more clear

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Fix documentation about timezone support.

Makes it clear that the default is UTC, but others are supported.

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Remove commented/unused function

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Fix tests using incorrect timezones

Previously tests were using time zone names that were unsupported by the
RFC822 parser. This switches the tests to use RFC822Z and specifies the
zones by number.

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Add a few more timezone test cases

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Remove unnecessary if/else branch

Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Rename timezone to location for consistency with Go stdlib

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Make Windows timezone error more specific

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Update docs to use 'location'

Signed-off-by: Ben Ridley <benridley29@gmail.com>

* Apply suggestions from code review

Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
Signed-off-by: Ben Ridley <benridley29@gmail.com>

Signed-off-by: Ben Ridley <benridley29@gmail.com>
Co-authored-by: Sylvain Rabot <sylvain@abstraction.fr>
2022-09-22 14:45:17 +02: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
Ben Ridley d0217a80b0 Add JSON marshalling and unmarshalling support for time intervals
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:02 +11:00
Ben Ridley 8e03268af9 Add additional test cases from code review
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:02 +11:00
Ben Ridley 11b643dd23 Remove superfluous test case
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:02 +11:00
Ben Ridley 1957e3c80e Add some more complete test cases, test for broken clamping
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:02 +11:00
Ben Ridley adf94c3168 Correct errors, test for specific error messages, improve formatting
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:01 +11:00
Ben Ridley 3ece40664b Remove unused test function
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:01 +11:00
Ben Ridley e052540c92 Add license header
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:01 +11:00
Ben Ridley 0e9838c8f3 Fix formatting
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:01 +11:00
Ben Ridley a3cb125e5c Move timeinterval library into locally maintained package
Signed-off-by: Ben Ridley <benridley29@gmail.com>
2021-03-01 08:30:01 +11:00