2828extern "C" {
2929#endif
3030
31+ /** Maximum number of severity filters per alert. */
3132#define ECS_ALERT_MAX_SEVERITY_FILTERS (4)
3233
33- /** Module id . */
34+ /** Module ID . */
3435FLECS_API extern ECS_COMPONENT_DECLARE (FlecsAlerts );
3536
36- /* Module components */
37+ /** Module components. */
3738
38- FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlert ); /**< Component added to alert, and used as first element of alert severity pair. */
39+ FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlert ); /**< Component added to alert, and used as the first element of the alert severity pair. */
3940FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlertInstance ); /**< Component added to alert instance. */
40- FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlertsActive ); /**< Component added to alert source which tracks how many active alerts there are. */
41- FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlertTimeout ); /**< Component added to alert which tracks how long an alert has been inactive. */
41+ FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlertsActive ); /**< Component added to alert source, which tracks how many active alerts there are. */
42+ FLECS_API extern ECS_COMPONENT_DECLARE (EcsAlertTimeout ); /**< Component added to alert, which tracks how long an alert has been inactive. */
4243
43- /* Alert severity tags */
44+ /** Alert severity tags. */
4445FLECS_API extern ECS_TAG_DECLARE (EcsAlertInfo ); /**< Info alert severity. */
4546FLECS_API extern ECS_TAG_DECLARE (EcsAlertWarning ); /**< Warning alert severity. */
4647FLECS_API extern ECS_TAG_DECLARE (EcsAlertError ); /**< Error alert severity. */
4748FLECS_API extern ECS_TAG_DECLARE (EcsAlertCritical ); /**< Critical alert severity. */
4849
4950/** Component added to alert instance. */
5051typedef struct EcsAlertInstance {
51- char * message ; /**< Generated alert message */
52+ char * message ; /**< Generated alert message. */
5253} EcsAlertInstance ;
5354
5455/** Map with active alerts for entity. */
5556typedef struct EcsAlertsActive {
56- int32_t info_count ; /**< Number of alerts for source with info severity */
57- int32_t warning_count ; /**< Number of alerts for source with warning severity */
58- int32_t error_count ; /**< Number of alerts for source with error severity */
59- ecs_map_t alerts ;
57+ int32_t info_count ; /**< Number of alerts for source with info severity. */
58+ int32_t warning_count ; /**< Number of alerts for source with warning severity. */
59+ int32_t error_count ; /**< Number of alerts for source with error severity. */
60+ ecs_map_t alerts ; /**< Map of active alerts for entity. */
6061} EcsAlertsActive ;
6162
6263/** Alert severity filter.
@@ -66,18 +67,18 @@ typedef struct EcsAlertsActive {
6667 * severity of an alert from Warning to Error.
6768 */
6869typedef struct ecs_alert_severity_filter_t {
69- ecs_entity_t severity ; /* Severity kind */
70- ecs_id_t with ; /* Component to match */
71- const char * var ; /* Variable to match component on. Do not include the
72- * '$' character. Leave to NULL for $this. */
73- int32_t _var_index ; /* Index of variable in filter (do not set) */
70+ ecs_entity_t severity ; /**< Severity kind. */
71+ ecs_id_t with ; /**< Component to match. */
72+ const char * var ; /**< Variable to match component on. Do not include the
73+ * '$' character. Leave as NULL for $this. */
74+ int32_t _var_index ; /**< Index of variable in query (do not set). */
7475} ecs_alert_severity_filter_t ;
7576
7677/** Alert descriptor, used with ecs_alert_init(). */
7778typedef struct ecs_alert_desc_t {
78- int32_t _canary ;
79+ int32_t _canary ; /**< Used for validity testing. Do not set. */
7980
80- /** Entity associated with alert */
81+ /** Entity associated with alert. */
8182 ecs_entity_t entity ;
8283
8384 /** Alert query. An alert will be created for each entity that matches the
@@ -96,13 +97,13 @@ typedef struct ecs_alert_desc_t {
9697 */
9798 const char * message ;
9899
99- /** User friendly name. Will only be set if FLECS_DOC addon is enabled. */
100+ /** User- friendly name. Will only be set if FLECS_DOC addon is enabled. */
100101 const char * doc_name ;
101102
102- /** Description of alert. Will only be set if FLECS_DOC addon is enabled */
103+ /** Description of alert. Will only be set if FLECS_DOC addon is enabled. */
103104 const char * brief ;
104105
105- /** Metric kind . Must be EcsAlertInfo, EcsAlertWarning, EcsAlertError or
106+ /** Alert severity . Must be EcsAlertInfo, EcsAlertWarning, EcsAlertError, or
106107 * EcsAlertCritical. Defaults to EcsAlertError. */
107108 ecs_entity_t severity ;
108109
@@ -114,20 +115,20 @@ typedef struct ecs_alert_desc_t {
114115
115116 /** The retain period specifies how long an alert must be inactive before it
116117 * is cleared. This makes it easier to track noisy alerts. While an alert is
117- * inactive its duration won't increase.
118+ * inactive, its duration won't increase.
118119 * When the retain period is 0, the alert will clear immediately after it no
119120 * longer matches the alert query. */
120121 ecs_ftime_t retain_period ;
121122
122- /** Alert when member value is out of range. Uses the warning/ error ranges
123+ /** Alert when member value is out of range. Uses the warning and error ranges
123124 * assigned to the member in the MemberRanges component (optional). */
124125 ecs_entity_t member ;
125126
126- /** (Component) id of member to monitor. If left to 0 this will be set to
127+ /** (Component) ID of member to monitor. If left to 0, this will be set to
127128 * the parent entity of the member (optional). */
128129 ecs_id_t id ;
129130
130- /** Variable from which to fetch the member (optional). When left to NULL
131+ /** Variable from which to fetch the member (optional). When left to NULL,
131132 * 'id' will be obtained from $this. */
132133 const char * var ;
133134} ecs_alert_desc_t ;
0 commit comments