Commit 13845e5
fix: update endsAt when resolving alerts via API
When an alert is posted via the API with only endsAt set (to resolve
an existing alert), the endsAt field was not being updated due to two
issues:
1. The merge condition in provider/mem/mem.go only merged alerts when
there was an overlap in activity range. This prevented merging when
resolving an alert (where the new endsAt is before the old endsAt
timeout).
2. The Merge function in types/types.go didn't properly handle the case
where a new resolved alert is merged with an existing unresolved alert.
This fix:
- Updates the merge condition to also merge when updating an existing
alert (same fingerprint), allowing updates like setting endsAt to
resolve an alert even without overlap.
- Updates the Merge function to always use the new alert's EndsAt when
it is resolved, ensuring that resolving an alert via API properly
updates the endsAt timestamp.
Fixes #4554
Signed-off-by: tennisleng <tennisleng@users.noreply.github.com>1 parent 45554d1 commit 13845e5
2 files changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
246 | | - | |
247 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
248 | 256 | | |
249 | 257 | | |
250 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
| |||
0 commit comments