Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7f5c8ff
replace Resolved with ResolvedAt to reduce amount of times we call ti…
evkuzin Nov 13, 2024
79db5fd
Merge branch 'main' into fix_time_now_enormous_overhead
evkuzin Nov 19, 2024
77ab544
chore(deps): bump `github.com/prometheus/common` from 0.60.0 to 0.61.…
mmorel-35 Dec 5, 2024
6703b0a
Merge pull request #4150 from mmorel-35/prometheus/common@v0.61.0
SuperQ Jan 15, 2025
f63fc7a
Fixed formatting error
Jan 16, 2025
ce016af
Bump UI docker image
SuperQ Jan 16, 2025
b4a2179
Merge pull request #4209 from prometheus/superq/bump_node
simonpasquier Jan 16, 2025
fa65edb
Document (#4210)
alexweav Jan 17, 2025
3b06b97
Merge pull request #4207 from Nikachev/fix_docs_slack
SuperQ Jan 17, 2025
d0eaa9f
Improve the documentation on escaping in UTF-8 matchers (#4157)
grobinson-grafana Jan 21, 2025
3f4530c
Fix rocketchat channel templating
rekup Jan 23, 2025
b5d1a64
* Fix typo for 'weight' to correct format of title (#4222)
dimahsu Jan 30, 2025
e937107
header for slack config (#4247)
xakaitetoia Feb 19, 2025
7779ba0
fix(ci): update promci to v0.4.6 to handle artifact actions deprecati…
rnaveiras Feb 19, 2025
ff47081
fix(ci): update promci to v0.4.6 to handle artifact actions deprecati…
rnaveiras Feb 19, 2025
34115a7
Fix subtle bug in JSON/YAML encoding of inhibition rules
grobinson-grafana Mar 5, 2025
b04a0c4
Merge pull request #4292 from grobinson-grafana/grobinson/fix-subtle-…
SuperQ Mar 5, 2025
05e380a
Render Jira project template when searching for existing issues (#4291)
waltherlee Mar 6, 2025
5fecfde
opsgenie : trim space for api key file (#4195)
zoov-xavier Mar 6, 2025
cdd134a
Fix descriptions for --enable-feature (#4214)
am97 Mar 6, 2025
046a5bf
Merge branch 'main' into fix/rocketchat-channel-template
gotjosh Mar 6, 2025
1948bdf
Fixed rocketchat_configs docs (#4217)
rekup Mar 6, 2025
69b09d9
Merge branch 'main' into fix/rocketchat-channel-template
gotjosh Mar 6, 2025
71c4b6b
Merge pull request #4220 from rekup/fix/rocketchat-channel-template
grobinson-grafana Mar 6, 2025
989d79b
Merge pull request #4119 from evkuzin/fix_time_now_enormous_overhead
grobinson-grafana Mar 6, 2025
6d721e2
revert tests
jkroepke Mar 6, 2025
4462331
Merge pull request #4218 from jkroepke/amtool
grobinson-grafana Mar 7, 2025
53ba378
Update CHANGELOG.md
grobinson-grafana Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2 ]
thread: [0, 1, 2]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/build
with:
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
Expand All @@ -40,7 +40,7 @@ jobs:
image: quay.io/prometheus/golang-builder:1.23-base
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/setup_environment
- run: make
- run: git diff --exit-code
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
thread: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
needs: ci
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/build
with:
parallelism: 12
Expand All @@ -29,7 +29,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/publish_main
with:
docker_hub_login: ${{ secrets.docker_hub_login }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
thread: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
needs: ci
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/build
with:
parallelism: 12
Expand All @@ -29,7 +29,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: prometheus/promci@3cb0c3871f223bd5ce1226995bd52ffb314798b6 # v0.1.0
- uses: prometheus/promci@c3c93a50d581b928af720f0134b2b2dad32a6c41 # v0.4.6
- uses: ./.github/promci/actions/publish_release
with:
docker_hub_login: ${{ secrets.docker_hub_login }}
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 0.28.1 / 2025-03-07

* [ENHANCEMENT] Improved performance of inhibition rules when using Equal labels. #4119
* [ENHANCEMENT] Improve the documentation on escaping in UTF-8 matchers. #4157
* [ENHANCEMENT] Update alertmanager_config_hash metric help to document the hash is not cryptographically strong. #4157
* [BUGFIX] Fix panic in amtool when using `--verbose`. #4218
* [BUGFIX] Fix templating of channel field for Rocket.Chat. #4220
* [BUGFIX] Fix `rocketchat_configs` written as `rocket_configs` in docs. #4217
* [BUGFIX] Fix usage for `--enable-feature` flag. #4214
* [BUGFIX] Trim whitespace from OpsGenie API Key. #4195
* [BUGFIX] Fix Jira project template not rendered when searching for existing issues. #4291
* [BUGFIX] Fix subtle bug in JSON/YAML encoding of inhibition rules that would cause Equal labels to be omitted. #4292
* [BUGFIX] Fix header for `slack_configs` in docs. #4247
* [BUGFIX] Fix weight and wrap of Microsoft Teams notifications. #4222
* [BUGFIX] Fix format of YAML examples in configuration.md. #4207

## 0.28.0 / 2025-01-15

* [CHANGE] Templating errors in the SNS integration now return an error. #3531 #3879
Expand Down
3 changes: 2 additions & 1 deletion cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ var (
func initMatchersCompat(_ *kingpin.ParseContext) error {
promslogConfig := &promslog.Config{Writer: os.Stdout}
if verbose {
promslogConfig.Level = &promslog.AllowedLevel{}
_ = promslogConfig.Level.Set("debug")
}
logger := promslog.New(promslogConfig)
Expand Down Expand Up @@ -155,7 +156,7 @@ func Execute() {
app.Flag("timeout", "Timeout for the executed command").Default("30s").DurationVar(&timeout)
app.Flag("http.config.file", "HTTP client configuration file for amtool to connect to Alertmanager.").PlaceHolder("<filename>").ExistingFileVar(&httpConfigFile)
app.Flag("version-check", "Check alertmanager version. Use --no-version-check to disable.").Default("true").BoolVar(&versionCheck)
app.Flag("enable-feature", fmt.Sprintf("Experimental features to enable. The flag can be repeated to enable multiple features. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").StringVar(&featureFlags)
app.Flag("enable-feature", fmt.Sprintf("Experimental features to enable, comma separated. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").StringVar(&featureFlags)

app.Version(version.Print("amtool"))
app.GetFlag("help").Short('h')
Expand Down
2 changes: 1 addition & 1 deletion cmd/alertmanager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func run() int {
tlsConfigFile = kingpin.Flag("cluster.tls-config", "[EXPERIMENTAL] Path to config yaml file that can enable mutual TLS within the gossip protocol.").Default("").String()
allowInsecureAdvertise = kingpin.Flag("cluster.allow-insecure-public-advertise-address-discovery", "[EXPERIMENTAL] Allow alertmanager to discover and listen on a public IP address.").Bool()
label = kingpin.Flag("cluster.label", "The cluster label is an optional string to include on each packet and stream. It uniquely identifies the cluster and prevents cross-communication issues when sending gossip messages.").Default("").String()
featureFlags = kingpin.Flag("enable-feature", fmt.Sprintf("Experimental features to enable. The flag can be repeated to enable multiple features. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").String()
featureFlags = kingpin.Flag("enable-feature", fmt.Sprintf("Comma-separated experimental features to enable. Valid options: %s", strings.Join(featurecontrol.AllowedFlags, ", "))).Default("").String()
)

promslogflag.AddFlags(kingpin.CommandLine, &promslogConfig)
Expand Down
9 changes: 2 additions & 7 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,11 +968,7 @@ type InhibitRule struct {
TargetMatchers Matchers `yaml:"target_matchers,omitempty" json:"target_matchers,omitempty"`
// A set of labels that must be equal between the source and target alert
// for them to be a match.
Equal model.LabelNames `yaml:"-" json:"-"`
// EqualStr allows us to validate the label depending on whether UTF-8 is
// enabled or disabled. It should be removed when Alertmanager is updated
// to use the validation modes in recent versions of prometheus/common.
EqualStr []string `yaml:"equal,omitempty" json:"equal,omitempty"`
Equal []string `yaml:"equal,omitempty" json:"equal,omitempty"`
}

// UnmarshalYAML implements the yaml.Unmarshaler interface for InhibitRule.
Expand All @@ -994,12 +990,11 @@ func (r *InhibitRule) UnmarshalYAML(unmarshal func(interface{}) error) error {
}
}

for _, l := range r.EqualStr {
for _, l := range r.Equal {
labelName := model.LabelName(l)
if !compat.IsValidLabelName(labelName) {
return fmt.Errorf("invalid label name %q in equal list", l)
}
r.Equal = append(r.Equal, labelName)
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@ func TestInhibitRuleEqual(t *testing.T) {
// The inhibition rule should have the expected equal labels.
require.Len(t, c.InhibitRules, 1)
r := c.InhibitRules[0]
require.Equal(t, model.LabelNames{"qux", "corge"}, r.Equal)
require.Equal(t, []string{"qux", "corge"}, r.Equal)

// Should not be able to load configuration with UTF-8 in equals list.
_, err = LoadFile("testdata/conf.inhibit-equal-utf8.yml")
Expand All @@ -1484,7 +1484,7 @@ func TestInhibitRuleEqual(t *testing.T) {
// The inhibition rule should have the expected equal labels.
require.Len(t, c.InhibitRules, 1)
r = c.InhibitRules[0]
require.Equal(t, model.LabelNames{"qux", "corge"}, r.Equal)
require.Equal(t, []string{"qux", "corge"}, r.Equal)

// Should also be able to load configuration with UTF-8 in equals list.
c, err = LoadFile("testdata/conf.inhibit-equal-utf8.yml")
Expand All @@ -1493,5 +1493,5 @@ func TestInhibitRuleEqual(t *testing.T) {
// The inhibition rule should have the expected equal labels.
require.Len(t, c.InhibitRules, 1)
r = c.InhibitRules[0]
require.Equal(t, model.LabelNames{"qux🙂", "corge"}, r.Equal)
require.Equal(t, []string{"qux🙂", "corge"}, r.Equal)
}
2 changes: 1 addition & 1 deletion config/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewCoordinator(configFilePath string, r prometheus.Registerer, l *slog.Logg
func (c *Coordinator) registerMetrics(r prometheus.Registerer) {
configHash := prometheus.NewGauge(prometheus.GaugeOpts{
Name: "alertmanager_config_hash",
Help: "Hash of the currently loaded alertmanager configuration.",
Help: "Hash of the currently loaded alertmanager configuration. Note that this is not a cryptographically strong hash.",
})
configSuccess := prometheus.NewGauge(prometheus.GaugeOpts{
Name: "alertmanager_config_last_reload_successful",
Expand Down
2 changes: 1 addition & 1 deletion config/notifiers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

commoncfg "github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/prometheus/common/sigv4"
"github.com/prometheus/sigv4"
)

var (
Expand Down
39 changes: 22 additions & 17 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ name: <string>
time_intervals:
[ - <time_interval_spec> ... ]
```

#### `<time_interval_spec>`

A `time_interval_spec` contains the actual definition for an interval of time. The syntax
Expand Down Expand Up @@ -339,9 +340,11 @@ make it easy to represent times that start/end on hour boundaries.
For example, `start_time: '17:00'` and `end_time: '24:00'` will begin at 17:00 and finish
immediately before 24:00. They are specified like so:

times:
- start_time: HH:MM
end_time: HH:MM
```yaml
times:
- start_time: HH:MM
end_time: HH:MM
```

`weekday_range`: A list of days of the week, where the week begins on Sunday and ends on Saturday.
Days should be specified by name (e.g. 'Sunday'). For convenience, ranges are also accepted
Expand All @@ -367,10 +370,12 @@ example, `'Australia/Sydney'`. The location provides the time zone for the time
interval. For example, a time interval with a location of `'Australia/Sydney'` that
contained something like:

times:
- start_time: 09:00
end_time: 17:00
weekdays: ['monday:friday']
```yaml
times:
- start_time: 09:00
end_time: 17:00
weekdays: ['monday:friday']
```

would include any time that fell between the hours of 9:00AM and 5:00PM, between Monday
and Friday, using the local time in Sydney, Australia.
Expand Down Expand Up @@ -437,7 +442,6 @@ source_matchers:
# Labels that must have an equal value in the source and target
# alert for the inhibition to take effect.
[ equal: '[' <labelname>, ... ']' ]

```

## Label matchers
Expand Down Expand Up @@ -465,7 +469,7 @@ Alertmanager runs in a special mode called fallback mode as its default mode. As
In fallback mode, configurations are first parsed as UTF-8 matchers, and if incompatible with the UTF-8 parser, are then parsed as classic matchers. If your Alertmanager configuration contains matchers that are incompatible with the UTF-8 parser, Alertmanager will parse them as classic matchers and log a warning. This warning also includes a suggestion on how to change the matchers from classic matchers to UTF-8 matchers. For example:

```
ts=2024-02-11T10:00:00Z caller=parse.go:176 level=warn msg="Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
ts=2024-02-11T10:00:00Z caller=parse.go:176 level=warn msg="Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted and backslashes are escaped. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
```

Here the matcher `foo=` can be made into a valid UTF-8 matcher by double quoting the right hand side of the expression to give `foo=""`. These two matchers are equivalent, however with UTF-8 matchers the right hand side of the matcher is a required field.
Expand All @@ -482,7 +486,7 @@ Any occurrences of disagreement should be looked at on a case by case basis as d

In UTF-8 strict mode, Alertmanager disables support for classic matchers:

```
```bash
alertmanager --config.file=config.yml --enable-feature="utf8-strict-mode"
```

Expand All @@ -498,7 +502,7 @@ UTF-8 strict mode will be the default mode of Alertmanager at the end of the tra

Classic mode is equivalent to Alertmanager versions 0.26.0 and older:

```
```bash
alertmanager --config.file=config.yml --enable-feature="classic-mode"
```

Expand All @@ -513,7 +517,7 @@ Just like Alertmanager server, `amtool` will log a warning if the configuration
```
amtool check-config config.yml
Checking 'config.yml'
level=warn msg="Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
level=warn msg="Alertmanager is moving to a new parser for labels and matchers, and this input is incompatible. Alertmanager has instead parsed the input using the classic matchers parser as a fallback. To make this input compatible with the UTF-8 matchers parser please make sure all regular expressions and values are double-quoted and backslashes are escaped. If you are still seeing this message please open an issue." input="foo=" origin=config err="end of input: expected label value" suggestion="foo=\"\""
level=warn msg="Matchers input has disagreement" input="qux=\"\\xf0\\x9f\\x99\\x82\"\n" origin=config
SUCCESS
Found:
Expand Down Expand Up @@ -571,9 +575,9 @@ A UTF-8 matcher consists of three tokens:
- One of `=`, `!=`, `=~`, or `!~`. `=` means equals, `!=` means not equal, `=~` means matches the regular expression and `!~` means doesn't match the regular expression.
- An unquoted literal or a double-quoted string for the regular expression or label value.

Unquoted literals can contain all UTF-8 characters other than the reserved characters. These are whitespace, and all characters in ``` { } ! = ~ , \ " ' ` ```. For example, `foo`, `[a-zA-Z]+`, and `Προμηθεύς` (Prometheus in Greek) are all examples of valid unquoted literals. However, `foo!` is not a valid literal as `!` is a reserved character.
Unquoted literals can contain all UTF-8 characters other than the reserved characters. The reserved characters include whitespace and all characters in ``` { } ! = ~ , \ " ' ` ```. For example, `foo`, `[a-zA-Z]+`, and `Προμηθεύς` (Prometheus in Greek) are all examples of valid unquoted literals. However, `foo!` is not a valid literal as `!` is a reserved character.

Double-quoted strings can contain all UTF-8 characters. Unlike unquoted literals, there are no reserved characters. You can even use UTF-8 code points. For example, `"foo!"`, `"bar,baz"`, `"\"baz qux\""` and `"\xf0\x9f\x99\x82"` are valid double-quoted strings.
Double-quoted strings can contain all UTF-8 characters. Unlike unquoted literals, there are no reserved characters. However, literal double quotes and backslashes must be escaped with a single backslash. For example, to match the regular expression `\d+` the backslash must be escaped `"\\d+"`. This is because double-quoted strings follow the same rules as Go's [string literals](https://go.dev/ref/spec#String_literals). Double-quoted strings also support UTF-8 code points. For example, `"foo!"`, `"bar,baz"`, `"\"baz qux\""` and `"\xf0\x9f\x99\x82"`.

#### Classic matchers

Expand Down Expand Up @@ -715,7 +719,7 @@ pagerduty_configs:
[ - <pagerduty_config>, ... ]
pushover_configs:
[ - <pushover_config>, ... ]
rocket_configs:
rocketchat_configs:
[ - <rocketchat_config>, ... ]
slack_configs:
[ - <slack_config>, ... ]
Expand Down Expand Up @@ -1347,15 +1351,17 @@ The fields are documented in the [Rocketchat API documentation](https://develope
```

#### `<rocketchat_action_config>`

The fields are documented in the [Rocketchat API api models](https://github.com/RocketChat/Rocket.Chat.Go.SDK/blob/master/models/message.go).

```yaml
[ type: <tmpl_string> | ignored, only "button" is supported ]
[ text: <tmpl_string> ]
[ url: <tmpl_string> ]
[ msg: <tmpl_string> ]
```

### `<slack_config>`
#### `<slack_config>`

Slack notifications can be sent via [Incoming webhooks](https://api.slack.com/messaging/webhooks) or [Bot tokens](https://api.slack.com/authentication/token-types).

Expand Down Expand Up @@ -1600,7 +1606,6 @@ url_file: <filepath>
# no timeout should be applied.
# NOTE: This will have no effect if set higher than the group_interval.
[ timeout: <duration> | default = 0s ]

```

The Alertmanager
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/common v0.61.0
github.com/prometheus/common/assets v0.2.0
github.com/prometheus/common/sigv4 v0.1.0
github.com/prometheus/exporter-toolkit v0.13.2
github.com/prometheus/sigv4 v0.1.0
github.com/rs/cors v1.11.1
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
Expand Down
Loading
Loading