Skip to content

Commit

Permalink
use status & description in health changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe authored and moshloop committed Nov 5, 2024
1 parent c5cc2c1 commit 4528e97
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion db/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func updateCI(ctx api.ScrapeContext, summary *v1.ScrapeSummary, result v1.Scrape
ConfigID: ci.ID,
ChangeType: lo.PascalCase(string(newHealth)),
Source: "config-db",
Summary: fmt.Sprintf("Health changed from %s to %s", previousHealth, newHealth),
Count: 1,
Details: map[string]any{
"previous": map[string]any{
Expand All @@ -181,6 +180,14 @@ func updateCI(ctx api.ScrapeContext, summary *v1.ScrapeSummary, result v1.Scrape
},
}

if lo.FromPtr(ci.Status) != "" {
healthChange.Summary = *ci.Status
}

if lo.FromPtr(ci.Description) != "" {
healthChange.Summary += fmt.Sprintf(": %s", *ci.Description)
}

if newHealth == dutyModels.HealthUnknown {
healthChange.ChangeType = "HealthUnknown"
}
Expand Down

0 comments on commit 4528e97

Please sign in to comment.