Commit Graph

70 Commits

Author SHA1 Message Date
Simon Pasquier 27e99e9e35 types: refactor *memMarker.Count method
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-05-24 13:36:01 +02:00
beorn7 3c981a92f7 Improve `Mutes` performance for silences
Add version tracking of silences states. Adding a silence to the state
increments the version. If the version hasn't changed since the last
time an alert was checked for being silenced, we only have to verify
that the relevant silences are still active rather than checking the
alert against all silences.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-28 12:34:41 +01:00
beorn7 12671bd261 Improve doc comments for Marker and friends
This clarifies a bunch of things I have run into during code reading
in preparation for some performance improvements around muting.

It also moves doc comments from places where they don't show up in
godoc to visible places.

It also fixes golint warnings.

Signed-off-by: beorn7 <beorn@soundcloud.com>
2019-02-25 17:48:15 +01:00
Max Leonard Inden 09a7370572
main.go: Move marker metric registering into types/types.go
Instead of registering marker metrics inside of
cmd/alertmanager/main.go, register them in types/types.go, encapsulating
marker specific logic in its module, not in main.go. In addition it
paves the path for removing the usage of the global metric registry in
the future, by taking a local metric registerer.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-02-05 14:59:22 +01:00
Simon Pasquier b676fa79c0 *: update Makefile.common with new staticcheck (#1692)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-01-04 15:37:33 +01:00
Simon Pasquier 008b4a93da
types: fix alert merging
Alert merging assumed that EndsAt would always be empty for firing
alerts. This is no longer true starting with Prometheus v2.4.0: EndsAt
is set to a multiple of the evaluation interval or resend interval
(whichever is the largest). This change updates the merging logic to
support both cases.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-11-09 16:48:46 +00:00
Simon Pasquier 6a7c912559 Sort alerts in correct order (#1349)
* Sort dispatched alerts by job+instance in the correct order (#1178)

Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>

* dispatch: add unit test for alerts sorting

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-06-14 15:54:33 +02:00
Simon Pasquier 0ebaeccd4b *: add missing license headers
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2018-05-14 17:37:13 +02:00
pasquier-s e8a92f65ef Run staticcheck as part of the build process (#1264)
This change also fixes potential issues highlighted by running
staticcheck.
2018-02-28 17:42:32 +01:00
Jose Donizetti fc9306cd7e Add expired silence validation (#1096)
* Add expired silence validation

* Add silence end time in the past validation
2018-01-21 15:29:51 +01:00
Jose Donizetti 20598bfd71 Remove old silence code (#1080) 2017-11-11 15:41:17 +01:00
Jose Donizetti cf85bd84f2 Add CalcSilenceState Test (#1085) 2017-11-11 15:13:12 +01:00
Jose Donizetti bc9b34d3db Add test to matchers (#1079)
* Add Test to Matcher and Matchers

* Move matchers string test to match_test.go
2017-11-07 11:39:22 +01:00
Julius Volz 9b72c10134 Minor code cleanups 2017-11-01 23:08:34 +01:00
Frederic Branczyk 0ef6695055
*: Remove .WasInhibited and .WasSilenced fields of Alert type 2017-10-10 15:50:15 +02:00
Corentin Chary bff889b490 silence|alerts: add metrics about current silences and alerts
This adds metrics that look like this:
```
alertmanager_alerts{state="active"} 6
alertmanager_alerts{state="suppressed"} 0
alertmanager_silences{state="active"} 1
alertmanager_silences{state="expired"} 1
alertmanager_silences{state="pending"} 0
```

This can be used to monitor alertmanager's usage and validate that
alertmanagers in a mesh have a similar number of silences and alerts.
2017-10-02 13:33:29 +02:00
Corentin Chary 9b2afbf18b Make sure Matchers are always ordered
This fixes https://github.com/prometheus/alertmanager/issues/881
Also add some unit tests
2017-06-23 15:30:34 +02:00
Max Leonard Inden 401e440db4
Return silence state on /silences
silenceState = "expired" | "active" | "pending"
```
"status": {
  "state": "expired"
}
```
2017-05-10 12:01:21 +02:00
Max Inden d463f1c298 Sync ui-rewrite with master (#779) 2017-05-10 11:49:02 +02:00
stuart nelson 6a909abf17 Add processing status field to alert 2017-04-27 14:18:52 +02:00
Fabian Reinartz 3269bc39e1 *: switch group key to matcher serialization
Turn the GroupKey into a string that is composed of the matchers if the
path in the routing tree and the grouping labels.
Only hash it at the very end to ensure we don't exceed size limits of
integration APIs.
2017-04-21 12:06:23 +02:00
Fabian Reinartz 8d88d9e05b Merge pull request #481 from prometheus/fabxc-meshsil
*: integrate new silence package
2016-08-30 16:53:34 +02:00
Fabian Reinartz 98101f3868 silence: fix doc strings 2016-08-30 14:19:22 +02:00
Fabian Reinartz a4e8703567 *: integrate new silence package 2016-08-30 12:15:23 +02:00
Fabian Reinartz 1baf98fb1a provider: remove NotificationInfos provider 2016-08-23 13:57:19 +02:00
Fabian Reinartz 66c2171bd8 *: rename NotifyInfo to NotificationInfo 2016-08-09 12:01:31 +02:00
Fabian Reinartz c0103dd8c6 provider/mesh: filter deleted silences from results 2016-08-09 12:00:52 +02:00
Fabian Reinartz 3d350a34b5 provider/mesh: extract silence deletion into state 2016-08-09 12:00:28 +02:00
Fabian Reinartz 4761663380 types: make Matchers sorted and compareable 2016-08-09 12:00:28 +02:00
Fabian Reinartz 6ad866dd27 types: validate ID existance for silences 2016-08-09 12:00:28 +02:00
Fabian Reinartz b92c5f5bd4 provider/mesh: add silence state 2016-08-09 11:59:35 +02:00
Fabian Reinartz 81cbf3cda7 *: refactor Silence type, use UUID
This commit removes the dependency on model.Silence for the internal
Silence type, uses UUIDs instead of uint64s and clarifies invariants
around timestamp handling.

The created_at timestamp is removed for the time being.
2016-08-09 11:59:35 +02:00
Fabian Reinartz 0e954e10cf provider/boltmem: Add Put/Get for BoltDB provider 2016-05-03 12:46:34 +02:00
Fabian Reinartz 438e22f246 Add merge alert test 2016-02-03 14:11:59 +01:00
Fabian Reinartz 4ada2398f2 Set previous inhibition/silence state 2015-12-04 10:58:56 +01:00
beorn7 93ffa534a5 PR with changes after code review
Now to be reverse-reveiewed.
2015-11-23 18:24:57 +01:00
Fabian Reinartz e4e594d826 Unify receiver naming 2015-11-10 13:47:04 +01:00
Fabian Reinartz d4e2bdc36f Track and expose silenced/inhibited status of alerts 2015-11-09 14:34:57 +01:00
Fabian Reinartz 8d2bbc348b Simplify and rename notification info struct.
The delivered field was previously unused and is removed by this commit.
Only successful notifications are stored. The type was renamed to NotifyInfo.
2015-11-06 10:09:39 +01:00
Fabian Reinartz 5ce39632f8 Fix go vet warnings 2015-11-05 10:25:25 +01:00
Fabian Reinartz a765ef9534 Add aggregation group unit test 2015-10-27 18:26:44 +01:00
Fabian Reinartz a4333564a0 Improve UI tree JSON, style UI tree 2015-10-22 09:49:16 +02:00
Fabian Reinartz c045a6285b Implement deterministic incident keys, complete PD integration 2015-10-21 13:08:53 +02:00
Fabian Reinartz 78008cd012 Fix infinite recursion bug in Alert merge 2015-10-15 16:21:36 +02:00
Fabian Reinartz 5dc2f6e9b1 Add license headers 2015-10-11 17:24:49 +02:00
Fabian Reinartz ce74f8363b Simplify initialization
No longer update components based on a new configuration. Generally,
destroying and recreating has no performance impact and is less
error-prone.
This also removes the Reloadable interface and simplifies the entire
startup contraption.
2015-10-11 16:54:39 +02:00
Fabian Reinartz 41821faf92 Use multi-error for notify-fanout 2015-10-11 12:40:43 +02:00
Fabian Reinartz 9b0ceacef8 Fix creation of model.Alert from types.Alert 2015-10-11 12:33:54 +02:00
Fabian Reinartz 7ef293d9bc Make loadable templates configurable 2015-10-09 11:06:04 +02:00
Fabian Reinartz 9bf18ec4a5 Always assume success on reload of valid config 2015-10-09 09:05:21 +02:00