mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Receiver API to use same logic for calculating UID as backend serivce (#91153)
use same logic for calculating uID as backend serivce
This commit is contained in:
parent
7ad37ff4e4
commit
1b4b1af9b7
@ -3,7 +3,6 @@ package receiver
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"hash/fnv"
|
|
||||||
|
|
||||||
"github.com/prometheus/alertmanager/config"
|
"github.com/prometheus/alertmanager/config"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -13,12 +12,11 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||||
|
"github.com/grafana/grafana/pkg/services/ngalert/notifier/legacy_storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getUID(t definitions.GettableApiReceiver) string {
|
func getUID(t definitions.GettableApiReceiver) string {
|
||||||
sum := fnv.New64()
|
return legacy_storage.NameToUid(t.Name)
|
||||||
_, _ = sum.Write([]byte(t.Name))
|
|
||||||
return fmt.Sprintf("%016x", sum.Sum64())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func convertToK8sResources(orgID int64, receivers []definitions.GettableApiReceiver, namespacer request.NamespaceMapper) (*model.ReceiverList, error) {
|
func convertToK8sResources(orgID int64, receivers []definitions.GettableApiReceiver, namespacer request.NamespaceMapper) (*model.ReceiverList, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user