Skip to content

Commit 6376148

Browse files
committed
chore: handle old events in cluster
Signed-off-by: Tanisha goyal <tanishag@nvidia.com>
1 parent b9ba256 commit 6376148

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

docs/designs/025-processing-strategy-for-health-checks.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,8 @@ func createPipeline() interface{} {
532532

533533
Update the default pipeline query to exclude `processingStrategy=STORE_ONLY` events. We need this condition for every rule that's why we are adding it at code level instead of keeping it at config file level.
534534

535+
**Backward Compatibility Note:** Historical events in the database (created before this feature) won't have the `processingstrategy` field. These old events should be treated as `EXECUTE_REMEDIATION` (they were meant to be processed). We use `$or` to explicitly match both `EXECUTE_REMEDIATION` and a missing field to ensure backward compatibility. Other modules and health monitors do not require changes since they only act on newly inserted events, which will already have the `processingStrategy` field set (all health monitors run in `EXECUTE_REMEDIATION` mode by default).
536+
535537
File: `health-events-analyzer/pkg/reconciler/reconciler.go`
536538

537539
```go
@@ -542,11 +544,18 @@ func (r *Reconciler) getPipelineStages(
542544
// CRITICAL: Always start with agent filter to exclude events from health-events-analyzer itself
543545
// This prevents the analyzer from matching its own generated events, which would cause
544546
// infinite loops and incorrect rule evaluations
547+
//
548+
// Backward Compatibility: Use $or to include events where processingstrategy is either
549+
// EXECUTE_REMEDIATION or missing (old events created before this feature was added).
550+
// Old events without this field should be treated as EXECUTE_REMEDIATION.
545551
pipeline := []map[string]interface{}{
546552
{
547553
"$match": map[string]interface{}{
548-
"healthevent.agent": map[string]interface{}{"$ne": "health-events-analyzer"},
549-
"healthevent.processingstrategy": map[string]interface{}{"$eq": "EXECUTE_REMEDIATION"}, // Exclude STORE_ONLY by default
554+
"healthevent.agent": map[string]interface{}{"$ne": "health-events-analyzer"},
555+
"$or": []map[string]interface{}{
556+
{"healthevent.processingstrategy": "EXECUTE_REMEDIATION"},
557+
{"healthevent.processingstrategy": map[string]interface{}{"$exists": false}},
558+
},
550559
},
551560
},
552561
}

0 commit comments

Comments
 (0)