Alerting: Fix state cache id duplication (#33480)
This commit is contained in:
@@ -38,6 +38,15 @@ func (il *InstanceLabels) ToDB() ([]byte, error) {
|
||||
return []byte{}, fmt.Errorf("database serialization of alerting ng Instance labels is not implemented")
|
||||
}
|
||||
|
||||
func (il *InstanceLabels) StringKey() (string, error) {
|
||||
tl := labelsToTupleLabels(*il)
|
||||
b, err := json.Marshal(tl)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("can not gereate key due to failure to encode labels: %w", err)
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
// StringAndHash returns a the json representation of the labels as tuples
|
||||
// sorted by key. It also returns the a hash of that representation.
|
||||
func (il *InstanceLabels) StringAndHash() (string, string, error) {
|
||||
|
||||
Reference in New Issue
Block a user