Skip to content

Commit 9ed2900

Browse files
authored
Merge branch 'master' into fix_patch_not_update_notificationpolicy_annotation
2 parents 3054a87 + 865afb8 commit 9ed2900

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

controllers/alertrulegroup_controller.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ func (r *GrafanaAlertRuleGroupReconciler) reconcileWithInstance(ctx context.Cont
202202
}
203203
if rule.NotificationSettings != nil {
204204
apiRule.NotificationSettings = &models.AlertRuleNotificationSettings{
205-
Receiver: &rule.NotificationSettings.Receiver,
206-
GroupBy: rule.NotificationSettings.GroupBy,
207-
GroupWait: rule.NotificationSettings.GroupWait,
208-
GroupInterval: rule.NotificationSettings.GroupInterval,
209-
RepeatInterval: rule.NotificationSettings.RepeatInterval,
205+
Receiver: &rule.NotificationSettings.Receiver,
206+
GroupBy: rule.NotificationSettings.GroupBy,
207+
GroupWait: rule.NotificationSettings.GroupWait,
208+
MuteTimeIntervals: rule.NotificationSettings.MuteTimeIntervals,
209+
GroupInterval: rule.NotificationSettings.GroupInterval,
210+
RepeatInterval: rule.NotificationSettings.RepeatInterval,
210211
}
211212
}
212213
if rule.Record != nil {

controllers/client/grafana_client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ func NewGeneratedGrafanaClient(ctx context.Context, c client.Client, grafana *v1
142142
}
143143

144144
transport := NewInstrumentedRoundTripper(grafana.IsExternal(), tlsConfig, metrics.GrafanaApiRequests.MustCurryWith(prometheus.Labels{
145-
"instance_name": grafana.Name,
145+
"instance_namespace": grafana.Namespace,
146+
"instance_name": grafana.Name,
146147
}))
147148
if grafana.Spec.Client != nil && grafana.Spec.Client.Headers != nil {
148149
transport.(*instrumentedRoundTripper).addHeaders(grafana.Spec.Client.Headers) //nolint:errcheck

controllers/client/http_client.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func NewHTTPClient(ctx context.Context, c client.Client, grafana *v1beta1.Grafan
2828
}
2929

3030
transport := NewInstrumentedRoundTripper(grafana.IsExternal(), tlsConfig, metrics.GrafanaApiRequests.MustCurryWith(prometheus.Labels{
31-
"instance_name": grafana.Name,
31+
"instance_namespace": grafana.Namespace,
32+
"instance_name": grafana.Name,
3233
}))
3334
if grafana.Spec.Client != nil && grafana.Spec.Client.Headers != nil {
3435
transport.(*instrumentedRoundTripper).addHeaders(grafana.Spec.Client.Headers) //nolint:errcheck

controllers/grafana_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (r *GrafanaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
7777
return ctrl.Result{}, err
7878
}
7979

80-
metrics.GrafanaReconciles.WithLabelValues(grafana.Name).Inc()
80+
metrics.GrafanaReconciles.WithLabelValues(grafana.Namespace, grafana.Name).Inc()
8181

8282
finished := true
8383
stages := getInstallationStages()
@@ -127,7 +127,7 @@ func (r *GrafanaReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
127127
log.Error(err, "reconciler error in stage", "stage", stage)
128128
nextStatus.LastMessage = err.Error()
129129

130-
metrics.GrafanaFailedReconciles.WithLabelValues(grafana.Name, string(stage)).Inc()
130+
metrics.GrafanaFailedReconciles.WithLabelValues(grafana.Namespace, grafana.Name, string(stage)).Inc()
131131
} else {
132132
nextStatus.LastMessage = ""
133133
}

controllers/metrics/metrics.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ var (
1111
Subsystem: "reconciler",
1212
Name: "reconciles",
1313
Help: "reconciles per Grafana instance",
14-
}, []string{"instance_name"})
14+
}, []string{"instance_namespace", "instance_name"})
1515

1616
GrafanaFailedReconciles = prometheus.NewCounterVec(prometheus.CounterOpts{
1717
Namespace: "grafana_operator",
1818
Subsystem: "reconciler",
1919
Name: "failed_reconciles",
2020
Help: "failed reconciles per Grafana instance and stage",
21-
}, []string{"instance_name", "stage"})
21+
}, []string{"instance_namespace", "instance_name", "stage"})
2222

2323
GrafanaApiRequests = prometheus.NewCounterVec(prometheus.CounterOpts{
2424
Namespace: "grafana_operator",
2525
Subsystem: "grafana_api",
2626
Name: "requests",
2727
Help: "requests against the grafana api per instance",
28-
}, []string{"instance_name", "method", "status"})
28+
}, []string{"instance_namespace", "instance_name", "method", "status"})
2929

3030
// Deprecated: will be removed in a future version of the operator. Use
3131
// ContentUrlRequests instead, which handles more types of resources that

0 commit comments

Comments
 (0)