Defines an alarm threshold and conditions. Published to a compacted Kafka topic via the REST API and materialized as a GlobalKTable state store in the alarm-service.
Key Fields
| Field | Type | Description |
|---|---|---|
| ruleId | string | UUID identifier |
| ruleName | string | Human-readable name |
| metric | enum | SCRAP_RATE, SCRAP_COUNT, SCRAP_VELOCITY_PER_HOUR, REWORK_COUNT, SCRAP_COUNT_BY_REASON_CODE |
| operator | enum | GT, GTE, LT, LTE |
| threshold | double | Value to compare against |
| lineId | string (nullable) | Null = applies to all lines |
| severity | enum | WARNING or CRITICAL |
| cooldownMinutes | int | Hysteresis cooldown (default: 15) |
| enabled | boolean | Whether the rule is active |
Example
{ "ruleId": "rule-high-scrap-rate", "ruleName": "High Scrap Rate", "metric": "SCRAP_RATE", "operator": "GT", "threshold": 0.10, "lineId": null, "factoryId": null, "reasonCode": null, "cooldownMinutes": 15, "severity": "WARNING", "enabled": true}