Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions controllers/prometheusrule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -305,6 +306,7 @@ func prometheusRuleToCoralogixAlertSpec(rule prometheus.Rule) coralogixv1alpha1.
Notifications: []coralogixv1alpha1.Notification{
{
RetriggeringPeriodMinutes: getNotificationPeriod(rule),
IntegrationName: getNotificationIntegrationName(rule),
},
},
},
Expand Down Expand Up @@ -363,6 +365,14 @@ func getNotificationPeriod(rule prometheus.Rule) int32 {
return defaultCoralogixNotificationPeriod
}

func getNotificationIntegrationName(rule prometheus.Rule) *string {
if integrationName, ok := rule.Annotations["cxNotificationName"]; ok {
return pointer.String(integrationName)
}

return nil
}

var prometheusAlertForToCoralogixPromqlAlertTimeWindow = map[prometheus.Duration]coralogixv1alpha1.MetricTimeWindow{
"1m": coralogixv1alpha1.MetricTimeWindow(coralogixv1alpha1.TimeWindowMinute),
"5m": coralogixv1alpha1.MetricTimeWindow(coralogixv1alpha1.TimeWindowFiveMinutes),
Expand Down