Skip to content

Commit fcffc73

Browse files
satterlyclaude
andcommitted
Rewrite lifecycle page with complete state transition tables
The previous table was missing shelved, blackout, and expired statuses, the unack/unshelve/close/open actions, severity change transitions, system actions, and blackout/plugin override behavior. Derived from the actual state machine in alerta/models/alarms/alerta.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5c7fdc5 commit fcffc73

1 file changed

Lines changed: 135 additions & 15 deletions

File tree

source/lifecycle.rst

Lines changed: 135 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,137 @@
1+
.. _lifecycle:
2+
3+
Alert Lifecycle
4+
===============
5+
6+
Alerta uses a state machine to manage alert status transitions. The status
7+
of an alert changes automatically based on incoming severity changes or
8+
explicitly via operator actions.
9+
10+
Statuses
11+
--------
12+
13+
+-----------------+----------------------------------------------------------+
14+
| Status | Description |
15+
+=================+==========================================================+
16+
| ``open`` | Alert is new or has been re-opened |
17+
+-----------------+----------------------------------------------------------+
18+
| ``assign`` | Alert has been assigned (placeholder, no transitions) |
19+
+-----------------+----------------------------------------------------------+
20+
| ``ack`` | Alert has been acknowledged by an operator |
21+
+-----------------+----------------------------------------------------------+
22+
| ``shelved`` | Alert has been shelved (temporarily hidden) |
23+
+-----------------+----------------------------------------------------------+
24+
| ``blackout`` | Alert was received during a blackout period |
25+
+-----------------+----------------------------------------------------------+
26+
| ``closed`` | Alert has been closed (normal severity or by operator) |
27+
+-----------------+----------------------------------------------------------+
28+
| ``expired`` | Alert was not updated within its timeout period |
29+
+-----------------+----------------------------------------------------------+
30+
31+
Actions
32+
-------
33+
34+
+------------------+---------------------------------------------------------+
35+
| Action | Description |
36+
+==================+=========================================================+
37+
| ``open`` | Re-open a closed, ack'd or expired alert |
38+
+------------------+---------------------------------------------------------+
39+
| ``ack`` | Acknowledge an open alert |
40+
+------------------+---------------------------------------------------------+
41+
| ``unack`` | Un-acknowledge, returns to previous status |
42+
+------------------+---------------------------------------------------------+
43+
| ``shelve`` | Shelve an open or ack'd alert |
44+
+------------------+---------------------------------------------------------+
45+
| ``unshelve`` | Un-shelve, returns to previous status |
46+
+------------------+---------------------------------------------------------+
47+
| ``close`` | Close an alert (sets severity to normal) |
48+
+------------------+---------------------------------------------------------+
49+
| ``expired`` | System action when alert times out |
50+
+------------------+---------------------------------------------------------+
51+
| ``timeout`` | System action on ack/shelve timeout |
52+
+------------------+---------------------------------------------------------+
153

254
State Transition Table
3-
~~~~~~~~~~~~~~~~~~~~~~
4-
5-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
6-
| Status | non-``normal`` | user ``ack`` | new > old | new <= old | ``normal`` | timeout |
7-
+=============+================+==============+===========+============+============+=============+
8-
| ``open`` | ``open`` | ``ack`` | | | ``closed`` | ``expired`` |
9-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
10-
| ``ack`` | | | ``open`` | ``ack`` | ``closed`` | |
11-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
12-
| ``assign`` | | | | | | |
13-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
14-
| ``closed`` | ``open`` | | | | ``closed`` | |
15-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
16-
| ``expired`` | ``open`` | | | | ``closed`` | |
17-
+-------------+----------------+--------------+-----------+------------+------------+-------------+
55+
----------------------
56+
57+
The table below shows the resulting status for each combination of current
58+
status and trigger (operator action or severity change). Empty cells mean
59+
the transition is not valid or the status remains unchanged.
60+
61+
**Operator Actions**
62+
63+
+------------------+------------+------------+------------+------------+------------+
64+
| Current Status | ``open`` | ``ack`` | ``unack`` | ``shelve`` | ``close`` |
65+
+==================+============+============+============+============+============+
66+
| ``open`` | *invalid* | ``ack`` | *invalid* | ``shelved``| ``closed`` |
67+
+------------------+------------+------------+------------+------------+------------+
68+
| ``ack`` | ``open`` | *invalid* | *previous* | ``shelved``| ``closed`` |
69+
+------------------+------------+------------+------------+------------+------------+
70+
| ``shelved`` | ``open`` | *invalid* | *invalid* | *invalid* | ``closed`` |
71+
+------------------+------------+------------+------------+------------+------------+
72+
| ``blackout`` | | | | | ``closed`` |
73+
+------------------+------------+------------+------------+------------+------------+
74+
| ``closed`` | ``open`` | *invalid* | | *invalid* | *invalid* |
75+
+------------------+------------+------------+------------+------------+------------+
76+
| ``expired`` | ``open`` | *invalid* | | | |
77+
+------------------+------------+------------+------------+------------+------------+
78+
79+
.. note::
80+
``unack`` returns to the status the alert had before it was acknowledged.
81+
``unshelve`` returns to the status the alert had before it was shelved.
82+
83+
**Severity Changes** (automatic, no operator action)
84+
85+
+------------------+---------------------+-------------------+--------------------+
86+
| Current Status | More severe | Less severe | Normal severity |
87+
+==================+=====================+===================+====================+
88+
| ``open`` | ``open`` | ``open`` | ``closed`` |
89+
+------------------+---------------------+-------------------+--------------------+
90+
| ``ack`` | ``open`` |dagger| | ``ack`` | ``closed`` |
91+
+------------------+---------------------+-------------------+--------------------+
92+
| ``shelved`` | ``shelved`` | ``shelved`` | ``closed`` |
93+
+------------------+---------------------+-------------------+--------------------+
94+
| ``blackout`` | *previous* | *previous* | ``closed`` |
95+
+------------------+---------------------+-------------------+--------------------+
96+
| ``closed`` | ``open`` |ddagger| | ``closed`` | ``closed`` |
97+
+------------------+---------------------+-------------------+--------------------+
98+
| ``expired`` | ``open`` | ``open`` | ``closed`` |
99+
+------------------+---------------------+-------------------+--------------------+
100+
101+
.. |dagger| unicode:: U+2020
102+
.. |ddagger| unicode:: U+2021
103+
104+
|dagger| An ack'd alert is re-opened only if the severity genuinely increases
105+
(ie. the previous severity was not the default ``indeterminate``).
106+
107+
|ddagger| A closed alert re-opens to ``shelved`` if it was previously shelved
108+
before being closed.
109+
110+
**System Actions**
111+
112+
+------------------+-----------------------------------------------------+
113+
| Action | Result |
114+
+==================+=====================================================+
115+
| ``expired`` | Any status -> ``expired`` |
116+
+------------------+-----------------------------------------------------+
117+
| ``timeout`` | If previously ``ack`` -> ``ack``, otherwise ``open``|
118+
+------------------+-----------------------------------------------------+
119+
120+
**Blackout Transitions**
121+
122+
When a blackout period ends, the alert returns to the status it had before
123+
the blackout began. If the alert was created during a blackout (no previous
124+
status), it transitions based on the current severity.
125+
126+
**Custom Actions**
127+
128+
Unrecognised actions (ie. custom actions defined by plugins via the
129+
``take_action`` hook) do not trigger any state transition. The severity
130+
and status are returned unchanged.
131+
132+
**Plugin Overrides**
133+
134+
If a ``pre_receive()`` plugin sets a non-default status on the alert, the
135+
state machine respects that status and skips the normal transition logic.
136+
The only exception is normal-severity alerts, which are always auto-closed
137+
regardless of the plugin-set status.

0 commit comments

Comments
 (0)