Commit Graph

3161 Commits

Author SHA1 Message Date
George Robinson 58dc6f8d33
Fix invalid silence causes incomplete updates (#3898)
This commit fixes a bug where an invalid silence causes incomplete
updates of existing silences. This is fixed moving validation
out of the setSilence method and putting it at the start of the
Set method instead.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-25 12:38:33 +01:00
George Robinson b676fc4d2e
Add tests for create and then update silences (#3899)
This commit adds a unit test for the postSilencesHandler to
create and then update a silence. It shows that changing the
ID of an existing silence returns 404 Not Found, and removing
the ID of an existing silence re-creates that silence with
a different ID.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-25 11:58:45 +01:00
George Robinson ffd7681fb4
Improve test coverage for silences (#3896)
This commit improves the existing test coverage for silences to
cover a number of additional cases, and also improve the comments
of existing cases.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-24 15:32:16 +01:00
George Robinson b4443817e8
Fix MaxSilences limit causes incomplete updates of existing silences (#3877)
* Fix MaxSilences limit causes incomplete updates of existing silences

This commit fixes a bug where the MaxSilences limit can cause an
incomplete update of existing silences, where the old silence can
be expired but the new silence cannot be created because it would
exceeded the maximum number of silences.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-24 15:11:10 +01:00
Simon Pasquier 36d653ab9f
Merge pull request #3755 from prometheus/dependabot/npm_and_yarn/ui/react-app/fork-ts-checker-webpack-plugin-9.0.2
Bump fork-ts-checker-webpack-plugin from 7.3.0 to 9.0.2 in /ui/react-app
2024-06-21 16:33:50 +02:00
Simon Pasquier 7c455af540
Merge pull request #3767 from prometheus/dependabot/npm_and_yarn/ui/react-app/webpack-5.76.0
Bump webpack from 5.75.0 to 5.76.0 in /ui/react-app
2024-06-21 16:32:36 +02:00
Simon Pasquier 1e6ca4f66d
Merge pull request #3732 from sathieu/default_smtp_tls_config
Support default SMTP TLS config
2024-06-21 16:32:14 +02:00
Simon Pasquier a03c2b9343
Merge pull request #3855 from prometheus/dependabot/go_modules/github.com/cespare/xxhash/v2-2.3.0
Bump github.com/cespare/xxhash/v2 from 2.2.0 to 2.3.0
2024-06-21 16:26:52 +02:00
Kapil Ramwani 25def02a7f
Fix: Hide config.SecretURL when the URL is incorrect. (#3887)
* fix: Hide config.SecretURL when the URL is incorrect.

    Updated the config.go to redact the URL.
    Added test cases to check URL stays hidden.
Signed-off-by: Kapil Ramwani(kanishkramwani6@gmail.com)

---------

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2024-06-21 16:19:06 +02:00
George Robinson 52eb1fc4aa
Rename matchers package to matcher singular (#3777)
* Rename matchers package to matcher singular

I realized that we had named the package plural "matchers" when
its idiomatic in Go to use singular package names.

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-21 16:17:27 +02:00
PrometheusBot 04174d7d7b
Synchronize common files from prometheus/prometheus (#3848)
* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* chore: fix test

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

---------

Signed-off-by: prombot <prometheus-team@googlegroups.com>
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
2024-06-21 16:14:46 +02:00
Simon Pasquier 02a017311e
Merge pull request #3881 from grobinson-grafana/grobinson/remove-id-from-set
Remove Id return from silences.Set(*pb.Silence)
2024-06-21 16:03:14 +02:00
dependabot[bot] 24be2dc3e3
Bump fork-ts-checker-webpack-plugin from 7.3.0 to 9.0.2 in /ui/react-app
Bumps [fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin) from 7.3.0 to 9.0.2.
- [Release notes](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/releases)
- [Changelog](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/blob/main/CHANGELOG.md)
- [Commits](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/compare/v7.3.0...v9.0.2)

---
updated-dependencies:
- dependency-name: fork-ts-checker-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-21 13:55:14 +00:00
George Robinson cc6de9c666 Remove Id return from silences.Set(*pb.Silence)
This commit removes the Id from the method silences.Set(*pb.Silence)
as it is redundant. The Id is still set even when creating a silence
fails. This will be fixed in a later change.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-20 15:47:49 +01:00
George Robinson e690fbe250
Rename silence limit to max-silence-size-bytes (#3886)
* Rename silence limit to max-silence-size-bytes

This commit renames an existing (unreleased) limit from
max-per-silence-bytes to max-silence-size-bytes.

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

* Update help

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-20 15:20:52 +01:00
George Robinson 124da3462d
Silence limits as functions (#3885)
* Silence limits as functions

This commit changes silence limits from a struct of ints to a struct
of functions that return individual limits. This allows limits
to be lazy-loaded and updated without having to call silences.New().

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

* Add explicit test for no limits

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

* Fix run()

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-20 14:50:53 +01:00
George Robinson db32fab612
Replace incorrect use of fmt.Errorf (#3883) 2024-06-20 12:02:05 +01: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
dependabot[bot] b59669f438
Bump golang.org/x/tools from 0.20.0 to 0.22.0 (#3867)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.20.0 to 0.22.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.20.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-06 09:13:59 +01:00
dependabot[bot] 6e27339d67
Bump github.com/cespare/xxhash/v2 from 2.2.0 to 2.3.0
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.2.0 to 2.3.0.
- [Commits](https://github.com/cespare/xxhash/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-06 08:09:34 +00:00
dependabot[bot] b8a6390dd6
Bump github.com/aws/aws-sdk-go from 1.52.3 to 1.53.14 (#3856)
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.52.3 to 1.53.14.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.52.3...v1.53.14)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-06 09:08:32 +01:00
Sergey 33e680a34d
feat: add time helpers (#3863)
Signed-off-by: Sergey <freak12techno@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
2024-06-05 15:23:42 +01:00
George Robinson f9d5a08759
Fix TestSilenceLimits tests (#3866)
This commit fixes silence tests that relied on the maintenance
function running at a fixed 100ms interval. If the go runtime
that runs the maintenance is not scheduled with 150ms then the
test will fail.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-05 15:03:00 +01:00
dependabot[bot] 2c189d81d9
Bump golang.org/x/text from 0.14.0 to 0.15.0 (#3854)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 18:39:46 +01:00
dependabot[bot] e74466904a
Bump github.com/prometheus/client_golang from 1.19.0 to 1.19.1 (#3857)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.19.0 to 1.19.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.19.0...v1.19.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-03 18:39:01 +01:00
George Robinson dbe6312f09
Limits should include expired silences (#3862)
* Limits should include expired silences

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

* Fix docs

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-06-03 09:12:19 +01:00
George Robinson b67bde8cf9
Add limits for silences (#3852)
* Add limits for silences

This commit adds limits for silences including the maximum number
of active and pending silences, and the maximum size per silence
(in bytes).

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

* Remove default limits

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

* Allow expiration of silences that exceed max size

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-05-31 17:52:44 +01:00
Marc Brugger 06b389bfec
allow webex roomID from template (#3801)
Signed-off-by: bakito <github@bakito.ch>
2024-05-30 14:20:38 +01:00
Simon Pasquier e5821b7891
Merge pull request #3845 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2024-05-28 21:29:55 +02:00
prombot f1e8806fa9 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-05-22 17:47:59 +00:00
Simon Pasquier fd37ce9c95
Merge pull request #3738 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2024-05-22 16:00:44 +02:00
Xiaochao Dong 91a94f00f9
Fix race conditions in the memory alerts store (#3648)
* Fix race conditions in the memory alerts store

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

* Expose the GC method from store.Alerts

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

* Use RLock/Unlock on read path

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

* Resolve conflicts

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

* release locks by using the defer

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

* Revert the RWMutex back to Mutex

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>

---------

Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
2024-05-16 11:25:21 +01:00
George Robinson df7041114d
Update docs for deprecation and removal of API v1 (#3841) 2024-05-14 21:35:37 +01:00
George Robinson c4a763c401
#3513: Mark muted alerts (#3793)
* Mark muted groups

This commit updates TimeMuteStage and TimeActiveStage to mark groups
as muted when its alerts are muted by an active or mute time interval,
and remove any existing markers when outside all active and mute
time intervals.

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

* Remove unlock to defer

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-05-13 11:16:26 +01:00
Simon Pasquier c9f73e3ab7
Merge pull request #3836 from prometheus/dependabot/go_modules/github.com/aws/aws-sdk-go-1.52.3
Bump github.com/aws/aws-sdk-go from 1.51.11 to 1.52.3
2024-05-07 14:57:32 +02:00
dependabot[bot] 168c2d55ed
Bump github.com/aws/aws-sdk-go from 1.51.11 to 1.52.3
Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.51.11 to 1.52.3.
- [Release notes](https://github.com/aws/aws-sdk-go/releases)
- [Commits](https://github.com/aws/aws-sdk-go/compare/v1.51.11...v1.52.3)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 12:45:44 +00:00
Simon Pasquier 477d7a4ba3
Merge pull request #3831 from prometheus/dependabot/go_modules/github.com/rs/cors-1.11.0
Bump github.com/rs/cors from 1.10.1 to 1.11.0
2024-05-07 14:45:16 +02:00
Simon Pasquier 42efba966b
Merge pull request #3830 from prometheus/dependabot/go_modules/github.com/go-openapi/runtime-0.28.0
Bump github.com/go-openapi/runtime from 0.27.1 to 0.28.0
2024-05-07 14:44:40 +02:00
Simon Pasquier 3591282158
Merge pull request #3828 from prometheus/dependabot/go_modules/github.com/cenkalti/backoff/v4-4.3.0
Bump github.com/cenkalti/backoff/v4 from 4.2.1 to 4.3.0
2024-05-07 14:44:25 +02:00
George Robinson ca4c90eb4e
Fix race condition in dispatch.go (#3826)
* Fix race condition in dispatch.go

This commit fixes a race condition in dispatch.go that would cause
a firing alert to be deleted from the aggregation group when instead
it should have been flushed.

The root cause is a race condition that can occur when dispatch.go
deletes resolved alerts from the aggregation group following a
successful notification. If a firing alert with the same
fingerprint is added back to the aggregation group at the same time
then the firing alert can be deleted.

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-05-07 10:34:03 +01:00
George Robinson d7ad5e12f8
Bump prometheus/common to v0.52.3 (#3806)
* Bump prometheus/common to v0.52.3

This commit bumps prometheus/common to v0.52.3. It has a breaking
change where the metric alertmanager_build_info has been renamed
to go_build_info as the metric has been moved from prometheus/common
to prometheus/client_golang and the namspace argument has been
removed.


---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-05-02 11:32:30 +01:00
dependabot[bot] 6a1c60af12
Bump github.com/rs/cors from 1.10.1 to 1.11.0
Bumps [github.com/rs/cors](https://github.com/rs/cors) from 1.10.1 to 1.11.0.
- [Commits](https://github.com/rs/cors/compare/v1.10.1...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/rs/cors
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 15:38:42 +00:00
dependabot[bot] 7bfb7cfb05
Bump github.com/go-openapi/runtime from 0.27.1 to 0.28.0
Bumps [github.com/go-openapi/runtime](https://github.com/go-openapi/runtime) from 0.27.1 to 0.28.0.
- [Release notes](https://github.com/go-openapi/runtime/releases)
- [Commits](https://github.com/go-openapi/runtime/compare/v0.27.1...v0.28.0)

---
updated-dependencies:
- dependency-name: github.com/go-openapi/runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 15:38:37 +00:00
dependabot[bot] 71e12f7837
Bump github.com/cenkalti/backoff/v4 from 4.2.1 to 4.3.0
Bumps [github.com/cenkalti/backoff/v4](https://github.com/cenkalti/backoff) from 4.2.1 to 4.3.0.
- [Commits](https://github.com/cenkalti/backoff/compare/v4.2.1...v4.3.0)

---
updated-dependencies:
- dependency-name: github.com/cenkalti/backoff/v4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 15:38:21 +00:00
George Robinson d31a249ffc
#3513: Add GroupMarker interface (#3792)
* Add GroupMarker interface

This commit adds a new GroupMarker interface that marks the status
of groups. For example, whether an alert is muted because or one
or more active or mute time intervals.

It renames the existing Marker interface to AlertMarker to avoid
confusion.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-30 15:26:04 +01:00
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
Gokhan a9b5cb4351
Enable setting ThreadId for Telegram notifications (#3638)
* Enable setting ThreadId for telegram notifications

Signed-off-by: Gokhan Sari <gokhan@sari.m

---------
Signed-off-by: gotjosh <josue.abreu@gmail.com>
2024-04-30 11:12:58 +01:00
Simon Pasquier 7aa3cde1af
Merge pull request #3783 from prometheus/dependabot/go_modules/github.com/go-openapi/strfmt-0.23.0
Bump github.com/go-openapi/strfmt from 0.22.0 to 0.23.0
2024-04-29 14:39:45 +02:00