Commit Graph

3028 Commits

Author SHA1 Message Date
George Robinson
f92a08d073
Remove unused feature flags (#3676)
This commit removes some code that should have been removed in #3668.
The FeatureFlags in silence.Options are no longer used but were
still initialized. These had a no-op effect.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-19 10:43:50 +00:00
Simon Pasquier
30fa9cd44b
Merge pull request #3671 from grobinson-grafana/grobinson/fix-missing-check-valid-labels
Fix missing check for len(name) == 0
2024-01-16 10:05:02 +01:00
George Robinson
0483a6ad0f Fix missing check for len(name) == 0
Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-15 19:46:52 +00:00
George Robinson
fa6a7e6dd6
Fix inconsistent defaults in UTF-8 behavior (#3668)
This commit fixes inconsistent UTF-8 behavior if the compat package is
not initialized and feature flags are not passed to the API. This can
happen when Alertmanager is used as a package in software such
as Cortex or Mimir.

The inconsistent behavior is that Alertmanager will accept UTF-8 alerts
but reject UTF-8 configurations.

Since feature flags are optional via api.Options, we cannot force them
to be passed to api.New at compile time. Instead, it's better to defer
back to the compat package which is consistent even when not initialized.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-15 10:03:51 +00:00
PrometheusBot
9ed52df5a7
Update common Prometheus files (#3666)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-01-09 08:56:05 +00:00
Simon Pasquier
ab2248afa7
Merge pull request #3650 from prometheus/dependabot/go_modules/github.com/prometheus/exporter-toolkit-0.11.0
Bump github.com/prometheus/exporter-toolkit from 0.10.0 to 0.11.0
2024-01-05 14:58:19 +01:00
dependabot[bot]
7c4793dd34
Bump github.com/prometheus/exporter-toolkit from 0.10.0 to 0.11.0
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-05 13:52:14 +00:00
Simon Pasquier
710b4c914f
Merge pull request #3651 from prometheus/dependabot/go_modules/github.com/prometheus/client_golang-1.18.0
Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0
2024-01-05 14:50:27 +01:00
Simon Pasquier
9efb81d55b
Merge pull request #3654 from prometheus/dependabot/go_modules/golang.org/x/tools-0.16.1
Bump golang.org/x/tools from 0.16.0 to 0.16.1
2024-01-05 14:49:32 +01:00
George Robinson
378933649c
Add origin to logs in compat (#3662)
Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-05 11:13:09 +00:00
George Robinson
848e2191d9
Support UTF-8 label matchers: Add metrics to matchers compat package (#3658)
* Add metrics to matchers compat package

This commit adds the following metrics to the compat package:

  alertmanager_matchers_parse
  alertmanager_matchers_disagree
  alertmanager_matchers_incompatible
  alertmanager_matchers_invalid

With a label called origin to differentiate the different sources
of inputs: the configuration file, the API, and amtool.

The disagree_total metric is incremented when an input is invalid
in both parsers, but results in different parsed representations,
then there is disagreement. This should not happen, and suggests
their is either a bug in one of the parsers or a mistake in the
backwards compatible guarantees of the matchers/parse parser.

The incompatible_total metric is incremented when an input is valid
in pkg/labels, but not the UTF-8 parser in matchers/parse. In such
case, the matcher should be updated to be compatible. This often
means adding double quotes around the right hand side of the matcher.
For example, foo="bar".

The invalid_total metric is incremented when an input is invalid
in both parsers. This was never a valid input.

The tests have been updated to check the metrics are incremented
as expected.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-05 10:21:20 +00:00
George Robinson
e772920993
Support UTF-8 label matchers: Make functions in compat package public (#3659)
* Make functions in compat package public

This commit makes functions in the compat package public. These
functions are useful for software that builds on top of the
Alertmanager that also need to migrate from classic mode to UTF-8.

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

* Fix lint

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2024-01-04 17:42:58 +00:00
dependabot[bot]
bbe10a338b
Bump github.com/alecthomas/kingpin/v2 from 2.3.2 to 2.4.0 (#3653)
Bumps [github.com/alecthomas/kingpin/v2](https://github.com/alecthomas/kingpin) from 2.3.2 to 2.4.0.
- [Release notes](https://github.com/alecthomas/kingpin/releases)
- [Commits](https://github.com/alecthomas/kingpin/compare/v2.3.2...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/kingpin/v2
  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-01-04 11:38:01 +00:00
dependabot[bot]
747410085a
Bump github.com/go-openapi/swag from 0.22.4 to 0.22.7 (#3655)
Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.22.4 to 0.22.7.
- [Commits](https://github.com/go-openapi/swag/compare/v0.22.4...v0.22.7)

---
updated-dependencies:
- dependency-name: github.com/go-openapi/swag
  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-01-04 11:37:48 +00:00
PrometheusBot
3383942745
Update common Prometheus files (#3643)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-01-04 11:37:15 +00:00
dependabot[bot]
70abb19825
Bump golang.org/x/tools from 0.16.0 to 0.16.1
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.16.0...v0.16.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 15:26:32 +00:00
dependabot[bot]
07a632467f
Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.17.0 to 1.18.0.
- [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.17.0...v1.18.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 15:26:15 +00:00
Karl-Philipp Richter
c920b605b6
Add links to concepts inhibition and grouping to docs/configuration.md (#3644)
Signed-off-by: Karl-Philipp Richter <krichter@posteo.de>
2023-12-18 18:25:23 +00:00
Simon Pasquier
0f2b0c8286
Merge pull request #3636 from mmorel-35/testifylint
golangci-lint: enable testifylint linter
2023-12-11 14:28:30 +01:00
Simon Pasquier
d11afddc9c
Merge pull request #3634 from prometheus/repo_sync
Synchronize common files from prometheus/prometheus
2023-12-11 11:21:31 +01:00
Simon Pasquier
a7252c7927
Merge pull request #3635 from hoffie/README-config-new-matchers
README: Use new matchers syntax in config examples
2023-12-11 10:41:43 +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
Christian Hoffmann
61e7ec8833
README: fix spelling in route config example comment
Signed-off-by: Christian Hoffmann <mail@hoffmann-christian.info>
2023-12-08 23:23:52 +01:00
Christian Hoffmann
a127573b14
README: use 0.22+ style matcher syntax from #1023
Signed-off-by: Christian Hoffmann <mail@hoffmann-christian.info>
2023-12-08 23:22:22 +01:00
prombot
8ccdfdfe53 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2023-12-08 17:48:12 +00:00
Ben Kochie
4a0bf2aa74
Merge pull request #3620 from mmorel-35/errors
use Go standard errors
2023-12-08 17:18:24 +01: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
Walther Lee
3416d5a4f5
Add context reasons to notifications failed counter (#3631)
---------

Signed-off-by: Walther Lee <walther.lee@reddit.com>
Co-authored-by: Walther Lee <walther.lee@reddit.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2023-12-08 15:30:43 +01:00
Simon Pasquier
dc1466487a
Merge pull request #3584 from prometheus/dependabot/go_modules/github.com/prometheus/common-0.45.0
Bump github.com/prometheus/common from 0.44.0 to 0.45.0
2023-12-08 08:40:06 +01:00
dependabot[bot]
14c254ac83
Bump github.com/prometheus/common from 0.44.0 to 0.45.0
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.44.0 to 0.45.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](https://github.com/prometheus/common/compare/v0.44.0...v0.45.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 17:16:45 +00:00
Ben Kochie
0c6393b3f4
Update golanci-lint (#3632)
Update golangci-lint from upstream Prometheus and fixup issues.

Signed-off-by: SuperQ <superq@gmail.com>
2023-12-07 16:42:42 +00:00
Simon Pasquier
83486834de
Merge pull request #3627 from prometheus/dependabot/go_modules/gopkg.in/telebot.v3-3.2.1
Bump gopkg.in/telebot.v3 from 3.1.3 to 3.2.1
2023-12-04 14:32:21 +01:00
dependabot[bot]
718792d59b
Bump gopkg.in/telebot.v3 from 3.1.3 to 3.2.1
Bumps gopkg.in/telebot.v3 from 3.1.3 to 3.2.1.

---
updated-dependencies:
- dependency-name: gopkg.in/telebot.v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 10:36:04 +00:00
Simon Pasquier
191b6f2117
Merge pull request #3626 from prometheus/dependabot/go_modules/golang.org/x/tools-0.16.0
Bump golang.org/x/tools from 0.14.0 to 0.16.0
2023-12-04 11:34:58 +01:00
dependabot[bot]
f5310baf84
Bump golang.org/x/tools from 0.14.0 to 0.16.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.14.0 to 0.16.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.14.0...v0.16.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>
2023-12-01 15:54:34 +00:00
Simon Pasquier
b82df1dc9b
Merge pull request #3628 from prometheus/dependabot/go_modules/golang.org/x/mod-0.14.0
Bump golang.org/x/mod from 0.13.0 to 0.14.0
2023-12-01 16:53:35 +01:00
Simon Pasquier
eae70acb1d
Merge pull request #3629 from prometheus/dependabot/go_modules/github.com/hashicorp/go-sockaddr-1.0.6
Bump github.com/hashicorp/go-sockaddr from 1.0.2 to 1.0.6
2023-12-01 16:52:51 +01:00
dependabot[bot]
63c3b26240
Bump github.com/hashicorp/go-sockaddr from 1.0.2 to 1.0.6
Bumps [github.com/hashicorp/go-sockaddr](https://github.com/hashicorp/go-sockaddr) from 1.0.2 to 1.0.6.
- [Commits](https://github.com/hashicorp/go-sockaddr/compare/v1.0.2...v1.0.6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 15:28:36 +00:00
dependabot[bot]
2c635c820d
Bump golang.org/x/mod from 0.13.0 to 0.14.0
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.13.0 to 0.14.0.
- [Commits](https://github.com/golang/mod/compare/v0.13.0...v0.14.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-01 15:27:24 +00:00
George Robinson
4494abfce4
Fix UTF-8 not supported in group_by (#3619)
* Fix UTF-8 not supported in group_by

This commit fixes missing UTF-8 support in the group_by for routes.

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

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-24 11:26:39 +00:00
George Robinson
70bd5dad98
Support UTF-8 label matchers: Use compat package in Alertmanager server (#3567)
* Support UTF-8 label matchers: Use compat package in Alertmanager server

This pull request adds use of the compat package in Alertmanager server that will allow users to switch between the new matchers/parse parser and the old pkg/labels parser. The new matchers/parse parser uses a fallback mechanism where if the input cannot be parsed in the new parser it then attempts to use the old parser. If an input is parsed in the old parser but not the new parser then a warning log is emitted.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-24 10:01:40 +00:00
gotjosh
b4f7027908
Deprecate and remove api/v1/ (#2970)
* Deprecate and remove api/v1/

Signed-off-by: gotjosh <josue.abreu@gmail.com>
---------

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-11-24 09:06:04 +00:00
romankubu
4f0bdf4940
Add summary to msteams notification (#3616)
* Add summary to msteams notification

Signed-off-by: Roman Kubu <Roman.Kubu@airbank.cz>
---------

Signed-off-by: Roman Kubu <Roman.Kubu@airbank.cz>
Signed-off-by: romankubu <112698283+romankubu@users.noreply.github.com>
Co-authored-by: Jack <jack4zhang@gmail.com>
2023-11-24 08:58:57 +00:00
gotjosh
aaf9490576
API: Allow the Silences API to use their own 400 response (#3610)
There's no change to the logic here - it just stroke me as odd that we were reusing the response from alerting groups in the silences call when it's pretty simple to add a new one in the API description.

This is more accurate as well, as this will be used to power the documentation.

Signed-off-by: gotjosh <josue.abreu@gmail.com>
2023-11-22 10:25:27 +00:00
George Robinson
ca5089d33e
Support UTF-8 label matchers: Rename feature flags and make package public (#3604)
* Rename feature flags and make package public

This commit renames the feature flags "classic-matchers-parsing"
and "utf8-matchers-parsing" to "classic-matchers" and "utf8-matchers".
This better represents their use, for example, when validating
both alerts and silences created via the API.

It also makes the feature flags package public for two reasons:

1. AllowedFlags is a public variable
2. We would rather use these consts in Mimir then have to hardcode
   the strings ourselves, and be subject to breaking changes in future

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

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-17 20:07:54 +00:00
Tomas Kozak
d2b6692f2c
Reflect Discord's max length message limits (#3597)
* Reflect Discord's max length message limits

Signed-off-by: Tomas Kozak <kozak@talko.cz>

* Fix log key name

Signed-off-by: Tomas Kozak <kozak@talko.cz>

---------

Signed-off-by: Tomas Kozak <kozak@talko.cz>
2023-11-15 07:37:47 +00:00
George Robinson
9dbc8b6b91
Support UTF-8 label matchers: Update Stringer for non-Prometheus compliant label names (#3580)
* Update Stringer for non-Prometheus compliant label names

This commit updates the String method to print non-Prometheus
compliant label names in a format that can be parsed in the
UTF-8 parser. Such inputs are never valid in the classic parser.
If the label name is Prometheus compliant, it is still printed
unquoted.

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

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-14 16:25:13 +00:00
Simon Pasquier
716830a56f
Merge pull request #3599 from cr7258/fix-label-mismatch
fix: label mismatch for alertmanager_notifications_failed_total
2023-11-14 11:39:36 +01:00
George Robinson
f96ba1b58f
unquote should check for invalid UTF-8 code points (#3595)
Quoted tokens can contain both UTF-8 byte and code point literals
that should be interpreted when quoted. However, we need to check
that the interpreted literals are valid UTF-8 code points or not.
This now happens in unquote.

Signed-off-by: George Robinson <george.robinson@grafana.com>
2023-11-13 16:31:15 +00:00
chengzw
aff09c28dc fix label mismatch for alertmanager_notifications_failed_total
Signed-off-by: chengzw <chengzw258@163.com>
2023-11-11 22:26:38 +08:00