Commit Graph

3148 Commits

Author SHA1 Message Date
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
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] 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
dependabot[bot] 25e5627d46
Bump github.com/go-openapi/strfmt from 0.22.0 to 0.23.0
Bumps [github.com/go-openapi/strfmt](https://github.com/go-openapi/strfmt) from 0.22.0 to 0.23.0.
- [Commits](https://github.com/go-openapi/strfmt/compare/v0.22.0...v0.23.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 12:29:11 +00:00
Simon Pasquier 99c31a677d
Merge pull request #3818 from prometheus/dependabot/go_modules/golang.org/x/tools-0.20.0
Bump golang.org/x/tools from 0.17.0 to 0.20.0
2024-04-29 14:28:34 +02:00
Simon Pasquier 26e58c680a
Merge pull request #3784 from prometheus/dependabot/go_modules/github.com/aws/aws-sdk-go-1.51.11
Bump github.com/aws/aws-sdk-go from 1.50.29 to 1.51.11
2024-04-29 14:27:54 +02:00
Simon Pasquier e7b9381b2e
Merge pull request #3782 from prometheus/dependabot/go_modules/github.com/hashicorp/memberlist-0.5.1
Bump github.com/hashicorp/memberlist from 0.5.0 to 0.5.1
2024-04-29 14:27:18 +02:00
youngwendy 72b62dbfea
chore: remove repetitive words (#3804)
Signed-off-by: youngwendy <clonefetch@outlook.com>
2024-04-25 18:54:53 +02:00
dependabot[bot] 09ff9a5c1c
Bump golang.org/x/tools from 0.17.0 to 0.20.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.17.0 to 0.20.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.17.0...v0.20.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>
2024-04-25 16:39:48 +00:00
dependabot[bot] 52f6c12b99
Bump github.com/hashicorp/memberlist from 0.5.0 to 0.5.1
Bumps [github.com/hashicorp/memberlist](https://github.com/hashicorp/memberlist) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/hashicorp/memberlist/releases)
- [Commits](https://github.com/hashicorp/memberlist/compare/v0.5.0...v0.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 16:39:34 +00:00
Holger Freyther 530bb3f6b3
ui: Force using linux/amd64 when using docker (#3807)
The elm npm package doesn't support linux/arm64. The easiest option
is to force docker to run this as a AMD64 container.

Upstream issue:
https://github.com/elm/compiler/issues/2283

Signed-off-by: Holger Hans Peter Freyther <holger@freyther.de>
2024-04-25 17:39:05 +01:00
Holger Freyther 5b99b12aca
dep: Manually upgrade golang.org/x/net (#3674) (#3811)
Addresses:
Scanning your code and 410 packages across 83 dependent modules for known vulnerabilities...

=== Symbol Results ===

Vulnerability #1: GO-2024-2687
    HTTP/2 CONTINUATION flood in net/http
  More info: https://pkg.go.dev/vuln/GO-2024-2687
  Module: golang.org/x/net
    Found in: golang.org/x/net@v0.20.0
    Fixed in: golang.org/x/net@v0.23.0
    Example traces found:
      #1: cli/root.go:122:52: cli.NewAlertmanagerClient calls config.NewClientFromConfig, which eventually calls http2.ConfigureTransports
      #2: types/types.go:290:28: types.MultiError.Error calls http2.ConnectionError.Error
      #3: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.ErrCode.String
      #4: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.FrameHeader.String
      #5: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.FrameType.String
      #6: types/types.go:290:28: types.MultiError.Error calls http2.GoAwayError.Error
      #7: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.Setting.String
      #8: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.SettingID.String
      #9: types/types.go:290:28: types.MultiError.Error calls http2.StreamError.Error
      #10: api/v2/client/silence/silence_client.go:196:35: silence.Client.PostSilences calls client.Runtime.Submit, which eventually calls http2.Transport.NewClientConn
      #11: api/v2/client/silence/silence_client.go:196:35: silence.Client.PostSilences calls client.Runtime.Submit, which eventually calls http2.Transport.RoundTrip
      #12: notify/email/email.go:253:14: email.Email.Notify calls fmt.Fprintf, which eventually calls http2.chunkWriter.Write
      #13: types/types.go:290:28: types.MultiError.Error calls http2.connError.Error
      #14: types/types.go:290:28: types.MultiError.Error calls http2.duplicatePseudoHeaderError.Error
      #15: test/cli/acceptance.go:362:3: cli.Alertmanager.Start calls http2.gzipReader.Close
      #16: test/cli/acceptance.go:366:22: cli.Alertmanager.Start calls io.ReadAll, which calls http2.gzipReader.Read
      #17: types/types.go:290:28: types.MultiError.Error calls http2.headerFieldNameError.Error
      #18: types/types.go:290:28: types.MultiError.Error calls http2.headerFieldValueError.Error
      #19: api/v2/client/silence/silence_client.go:196:35: silence.Client.PostSilences calls client.Runtime.Submit, which eventually calls http2.noDialH2RoundTripper.RoundTrip
      #20: types/types.go:290:28: types.MultiError.Error calls http2.pseudoHeaderError.Error
      #21: notify/email/email.go:253:14: email.Email.Notify calls fmt.Fprintf, which eventually calls http2.stickyErrWriter.Write
      #22: test/cli/acceptance.go:362:3: cli.Alertmanager.Start calls http2.transportResponseBody.Close
      #23: test/cli/acceptance.go:366:22: cli.Alertmanager.Start calls io.ReadAll, which calls http2.transportResponseBody.Read
      #24: notify/notify.go:998:21: notify.TimeActiveStage.Exec calls log.jsonLogger.Log, which eventually calls http2.writeData.String

Your code is affected by 1 vulnerability from 1 module.
This scan also found 0 vulnerabilities in packages you import and 2
vulnerabilities in modules you require, but your code doesn't appear to call
these vulnerabilities.
Use '-show verbose' for more details.

Signed-off-by: Holger Hans Peter Freyther <holger@freyther.de>
2024-04-25 17:38:44 +01:00
George Robinson 7106bcc1ab
Fix version in APIv1 deprecation notice (#3815)
Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-23 16:16:01 +01:00
George Robinson dc1e1a2b88
Add date and tz functions to templates (#3812)
* Add date and tz functions to templates

This commit adds the date and tz functions to templates. This means
users can now format time in a specified format and also change
the timezone to their specific locale.

An example of how these functions work, and can be composed together,
can be seen here:

	{{ .StartsAt | tz "Europe/Paris" | date "15:04:05 MST" }}

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-04-22 16:15:33 +02:00