You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/11/10 10:20:08 UTC
[camel-k] 08/25: feat: Install alerting rule for reconciliation
request duration SLO
This is an automated email from the ASF dual-hosted git repository.
astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 6266dfbfce0bbe21233ae5d57ec4bcabe00cccc6
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Oct 20 15:12:43 2020 +0200
feat: Install alerting rule for reconciliation request duration SLO
---
deploy/operator-prometheus-rule.yaml | 16 ++++++++++++++++
pkg/install/operator.go | 9 +++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/deploy/operator-prometheus-rule.yaml b/deploy/operator-prometheus-rule.yaml
new file mode 100644
index 0000000..f88a35e
--- /dev/null
+++ b/deploy/operator-prometheus-rule.yaml
@@ -0,0 +1,16 @@
+apiVersion: monitoring.coreos.com/v1
+kind: PrometheusRule
+metadata:
+ name: camel-k-operator
+spec:
+ groups:
+ - name: camel-k-operator
+ rules:
+ - alert: CamelKReconciliationDuration
+ expr: 100 * (1 - sum(rate(camel_k_reconciliation_duration_seconds_bucket{le="0.5"}[5m])) by (job) / sum(rate(camel_k_reconciliation_duration_seconds_count[5m])) by (job)) > 10
+ for: 1m
+ labels:
+ severity: warning
+ annotations:
+ message: |
+ {{ printf "%0.0f" $value }}% of the reconciliation requests for {{ $labels.job }} have their duration above 0.5s.
\ No newline at end of file
diff --git a/pkg/install/operator.go b/pkg/install/operator.go
index 2b1ee78..ca6cd3e 100644
--- a/pkg/install/operator.go
+++ b/pkg/install/operator.go
@@ -170,11 +170,11 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu
}
if cfg.Monitoring.Enabled {
- if err := installPodMonitor(ctx, c, cfg.Namespace, customizer, collection, force); err != nil {
+ if err := installMonitoringResources(ctx, c, cfg.Namespace, customizer, collection, force); err != nil {
if k8serrors.IsForbidden(err) {
- fmt.Println("Warning: the creation of PodMonitor resources is not allowed. Try installing as cluster-admin to allow the creation of PodMonitor resources.")
+ fmt.Println("Warning: the creation of monitoring resources is not allowed. Try installing as cluster-admin to allow the creation of monitoring resources.")
} else if meta.IsNoMatchError(errors.Cause(err)) {
- fmt.Println("Warning: the creation of the PodMonitor resource has failed: ", err)
+ fmt.Println("Warning: the creation of the monitoring resources failed: ", err)
} else {
return err
}
@@ -230,9 +230,10 @@ func installStrimziBindings(ctx context.Context, c client.Client, namespace stri
)
}
-func installPodMonitor(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error {
+func installMonitoringResources(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error {
return ResourcesOrCollect(ctx, c, namespace, collection, force, customizer,
"operator-pod-monitor.yaml",
+ "operator-prometheus-rule.yaml",
)
}