Commit Graph

121 Commits

Author SHA1 Message Date
Simon Pasquier
25b32434a6
store: fix potential flaky test ()
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-10-22 09:25:31 +02:00
Simon Pasquier
4535311c34 dispatch: don't garbage-collect alerts from store
The aggregation group is already responsible for removing the resolved
alerts. Running the garbage collection in parallel introduces a race and
eventually resolved notifications may be dropped.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-09-18 11:42:14 +02:00
Simon Pasquier
c78b449f4a provider/mem: fix dropped alerts
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-19 15:35:21 +02:00
Simon Pasquier
510cb2936f provider/mem: add test detecting dropped alerts
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-04-19 14:00:58 +02: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
Steve Winslow
8ca1f66a2d Fixed typo in license statement URL
Signed-off-by: Steve Winslow <swinslow@gmail.com>
2018-12-02 08:12:09 -05:00
stuart nelson
e883ccb9de
pull out shared code for storing alerts ()
Move the code for storing and GC'ing alerts from being re-implemented in
several packages to existing in its own package

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
2018-09-03 14:52:53 +02:00
Max Leonard Inden
1219541184
*.go: Introduce errcheck enforcing error handling
Errcheck [1] enforces error handling accross all go files. Functions can
be excluded via `scripts/errcheck_excludes.txt`.

This patch adds errcheck to the `test` Make target.

[1] https://github.com/kisielk/errcheck

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-08-30 15:47:13 +02:00
Sergiusz Urbaniak
f9896e0162
provider/mem: cleanup closed listener in GC
... rather than in the Subscribe method. Currently the cleanup for a
given Alert subscription is done in a blocking goroutine, started in
the Subscribe method.

This simplifies it by moving the cleanup to the GC.

Additionally it simplifies the subscribe method by setting up the
buffered channel big enough to fill it up with all pending alerts
preventing the necessity to start a goroutine in Subscribe at all.

Signed-off-by: Sergiusz Urbaniak <sergiusz.urbaniak@gmail.com>
2018-08-13 09:35:11 +02:00
Max Inden
d4788ed195 provider/mem: Add Put Subscribe starvation test ()
TestAlertsSubscribePutStarvation tests starvation of `iterator.Close` and
`alerts.Put`. Both `Subscribe` and `Put` use the Alerts.mtx lock. `Subscribe`
needs it to subscribe and more importantly unsubscribe `Alerts.listeners`.
`Put` uses the lock to add additional alerts and iterate the `Alerts.listeners`
map.  If the channel of a listener is at its limit, `alerts.Lock` is blocked,
whereby a listener can not unsubscribe as the lock is hold by `alerts.Lock`.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2018-08-06 16:00:17 +02:00
wangYue
0fc0ff8e71 Avoid listener blocking ()
Signed-off-by: wangyue <wangyue@actiontech.com>
2018-08-06 13:24:21 +02:00
pasquier-s
7b80919b36 Remove unused code () 2018-03-03 11:07:47 +01:00
pasquier-s
e8a92f65ef Run staticcheck as part of the build process ()
This change also fixes potential issues highlighted by running
staticcheck.
2018-02-28 17:42:32 +01:00
pasquier-s
29e441f88f Fix miscellaneous issues revealed by Go 1.10 ()
* provider/mem: fix format verbs in tests

* api: fix format verb
2018-02-22 14:57:45 +00:00
Stuart Nelson
b45c11b561 Fix tests 2018-01-21 15:38:19 +01:00
Jose Donizetti
2fe013bcaa Add tests to memory provider () 2018-01-21 15:27:21 +01:00
stuart nelson
69b97058f6 Fix tests 2017-12-19 15:43:23 +01:00
stuart nelson
481eab7b83 Make alertGC interval configurable 2017-12-19 15:36:38 +01:00
Fabian Reinartz
8170206070 Fix alert status handling in UI 2017-05-08 12:56:03 +02:00
stuart nelson
6a909abf17 Add processing status field to alert 2017-04-27 14:18:52 +02:00
Fabian Reinartz
3b5dfa8aba provider: delete old silence provider 2016-08-30 12:01:24 +02:00
Fabian Reinartz
1baf98fb1a provider: remove NotificationInfos provider 2016-08-23 13:57:19 +02:00
Fabian Reinartz
6a20296af4 *: fixup, remove bolt provider 2016-08-09 14:17:50 +02:00
Fabian Reinartz
96fa0bb468 provider/mesh: set expiration time on create 2016-08-09 12:01:31 +02:00
Fabian Reinartz
bebda718c0 provider/mesh: use protobuf gossip format
stuff
2016-08-09 12:01:31 +02:00
Fabian Reinartz
91fd3f5b3a provider/mesh: use struct for string in state map 2016-08-09 12:01:31 +02:00
Fabian Reinartz
66c2171bd8 *: rename NotifyInfo to NotificationInfo 2016-08-09 12:01:31 +02:00
Fabian Reinartz
37eb2127b7 provider/mesh: add doc comments 2016-08-09 12:01:31 +02:00
Fabian Reinartz
fdf09b6ae6 provider/mesh: implement snapshotting
This change adds snapshotting to the silences and notification infos
providers. Snapshots are created periodically and on shutdown. They are
loaded into memory on startup.
Periodic snapshotting is run right after garbage collection.
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
022adbff36 provider/mesh: fix end timestamp for unstarted silences
This changes the end timestamp for unstarted silences to the
start timestamp so the silence remains valid by not having the end
time before the start time.
2016-08-09 12:00:52 +02:00
Fabian Reinartz
a89ba5b5ca provider/mesh: allow timestamp equality tolerance 2016-08-09 12:00:28 +02:00
Fabian Reinartz
ddd3189bfe provider/mesh: always store UTC 2016-08-09 12:00:28 +02:00
Fabian Reinartz
2a7047cdc1 *: fix golint warnings, add TODOs 2016-08-09 12:00:28 +02:00
Fabian Reinartz
00f1f1f8bf provider/mesh: fix silence end time modification 2016-08-09 12:00:28 +02:00
Fabian Reinartz
8a517b485d *: activate mesh garbage collection 2016-08-09 12:00:28 +02:00
Fabian Reinartz
dfa79409ae provider/mesh: add silence garbage collection 2016-08-09 12:00:28 +02:00
Fabian Reinartz
c1ee634c16 provider/mesh: add notification garbage collection 2016-08-09 12:00:28 +02:00
Fabian Reinartz
06a8700472 provider/mesh: fix and test modification validity
This change fixes, extends, and tests silenceModAllowed. It now can also
be applied to new silences.
2016-08-09 12:00:28 +02:00
Fabian Reinartz
57b60ba33e provider/mesh: add silence state del test 2016-08-09 12:00:28 +02:00
Fabian Reinartz
3d350a34b5 provider/mesh: extract silence deletion into state 2016-08-09 12:00:28 +02:00
Fabian Reinartz
9039a3cffa provider/mesh: add Silences Set test 2016-08-09 12:00:28 +02:00
Fabian Reinartz
4a336799ef provider/mesh: extract setting into silenceState
This change extracts setting logic directly into the silence state.
Only assigning of a UUID and mesh propagation are left directly to
the mesh provider.
Validity of modifying silence state extracted into its own method.
Test for state modification added.
2016-08-09 12:00:28 +02:00
Fabian Reinartz
cb74e2ad41 provider/mesh: add NotificationInfos Get test 2016-08-09 12:00:28 +02:00
Fabian Reinartz
d241016f95 proivder/mesh: add NotificationInfos Set test 2016-08-09 12:00:28 +02:00
Fabian Reinartz
3ebf21b7b4 provider/mesh: test NotificationInfos OnGossip* 2016-08-09 12:00:28 +02:00
Fabian Reinartz
e51770ce21 main: use mesh providers 2016-08-09 12:00:28 +02:00
Fabian Reinartz
9993a4f244 provider/mesh: add silence provider 2016-08-09 11:59:35 +02:00
Fabian Reinartz
3c7a16a838 provider/mesh: add notification gossip peer 2016-08-09 11:59:35 +02:00
Fabian Reinartz
b92c5f5bd4 provider/mesh: add silence state 2016-08-09 11:59:35 +02:00