Alerting: Add doc comments to state struct and normalize fields (#56647)

This commit is contained in:
George Robinson
2022-10-11 09:30:33 +01:00
committed by GitHub
parent fa09aef4ba
commit 52965de369
6 changed files with 91 additions and 65 deletions

View File

@@ -122,7 +122,7 @@ func (rs *ruleStates) getOrCreate(ctx context.Context, log log.Logger, alertRule
newState := &State{
AlertRuleUID: alertRule.UID,
OrgID: alertRule.OrgID,
CacheId: id,
CacheID: id,
Labels: lbs,
Annotations: annotations,
EvaluationDuration: result.EvaluationDuration,
@@ -171,7 +171,7 @@ func (c *cache) set(entry *State) {
if _, ok := c.states[entry.OrgID][entry.AlertRuleUID]; !ok {
c.states[entry.OrgID][entry.AlertRuleUID] = &ruleStates{states: make(map[string]*State)}
}
c.states[entry.OrgID][entry.AlertRuleUID].states[entry.CacheId] = entry
c.states[entry.OrgID][entry.AlertRuleUID].states[entry.CacheID] = entry
}
func (c *cache) get(orgID int64, alertRuleUID, stateId string) *State {