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
The following commit(s) were added to refs/heads/master by this push: new c7e7496 [ENTESB-15644] Fix monitoring test c7e7496 is described below commit c7e7496a3498914994cdc94fa725f91fc2e3c384 Author: Lukas Lowinger <llowi...@redhat.com> AuthorDate: Thu Jan 28 17:39:08 2021 +0100 [ENTESB-15644] Fix monitoring test --- .../openshift/monitoring/monitoringResources.sh | 21 +++ .../operator-pod-monitor.yaml} | 30 ++--- .../resources/operator-prometheus-rule.yaml | 145 +++++++++++++++++++++ e2e/yaks/openshift/monitoring/yaks-config.yaml | 4 +- 4 files changed, 183 insertions(+), 17 deletions(-) diff --git a/e2e/yaks/openshift/monitoring/monitoringResources.sh b/e2e/yaks/openshift/monitoring/monitoringResources.sh new file mode 100644 index 0000000..3c11d9d --- /dev/null +++ b/e2e/yaks/openshift/monitoring/monitoringResources.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SOURCE_DIR=$( dirname "${BASH_SOURCE[0]}") +RESOURCES_FOLDER="${SOURCE_DIR}/resources" +oc create -n ${YAKS_NAMESPACE} -f $RESOURCES_FOLDER/operator-pod-monitor.yaml +oc create -n ${YAKS_NAMESPACE} -f $RESOURCES_FOLDER/operator-prometheus-rule.yaml \ No newline at end of file diff --git a/e2e/yaks/openshift/monitoring/yaks-config.yaml b/e2e/yaks/openshift/monitoring/resources/operator-pod-monitor.yaml similarity index 59% copy from e2e/yaks/openshift/monitoring/yaks-config.yaml copy to e2e/yaks/openshift/monitoring/resources/operator-pod-monitor.yaml index 242ae05..f0d9e60 100644 --- a/e2e/yaks/openshift/monitoring/yaks-config.yaml +++ b/e2e/yaks/openshift/monitoring/resources/operator-pod-monitor.yaml @@ -15,19 +15,17 @@ # limitations under the License. # --------------------------------------------------------------------------- -config: - namespace: - temporary: true -pre: - - name: ObtainToken - script: ./obtainToken.sh - - name: Camel-k install - run: | - kamel install -w -n ${YAKS_NAMESPACE} --monitoring=true - - name: Dependency install - script: ./dependencyInstall.sh - - name: Integration run - run: | - set +e - kamel run --name metrics Metrics.java -w -n $YAKS_NAMESPACE --dependency mvn:com.github.openshift-integration:camel-k-example-metrics-non-existing:1.0.0-SNAPSHOT - kamel run --name metrics Metrics.java -w -n $YAKS_NAMESPACE --dependency mvn:com.github.openshift-integration:camel-k-example-metrics:1.0.0-SNAPSHOT \ No newline at end of file +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: camel-k-operator + labels: + app: "camel-k" + camel.apache.org/component: operator +spec: + selector: + matchLabels: + app: "camel-k" + camel.apache.org/component: operator + podMetricsEndpoints: + - port: metrics \ No newline at end of file diff --git a/e2e/yaks/openshift/monitoring/resources/operator-prometheus-rule.yaml b/e2e/yaks/openshift/monitoring/resources/operator-prometheus-rule.yaml new file mode 100644 index 0000000..2e00f68 --- /dev/null +++ b/e2e/yaks/openshift/monitoring/resources/operator-prometheus-rule.yaml @@ -0,0 +1,145 @@ +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: camel-k-operator +spec: + groups: + - name: camel-k-operator + rules: + - alert: CamelKReconciliationDuration + expr: | + ( + 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) + ) + * 100 + > 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. + - alert: CamelKReconciliationFailure + expr: | + sum(rate(camel_k_reconciliation_duration_seconds_count{result="Errored"}[5m])) by (job) + / + sum(rate(camel_k_reconciliation_duration_seconds_count[5m])) by (job) + * 100 + > 1 + for: 10m + labels: + severity: warning + annotations: + message: | + {{ printf "%0.0f" $value }}% of the reconciliation requests + for {{ $labels.job }} have failed. + - alert: CamelKSuccessBuildDuration2m + expr: | + ( + 1 - sum(rate(camel_k_build_duration_seconds_bucket{le="120",result="Succeeded"}[5m])) by (job) + / + sum(rate(camel_k_build_duration_seconds_count{result="Succeeded"}[5m])) by (job) + ) + * 100 + > 10 + for: 1m + labels: + severity: warning + annotations: + message: | + {{ printf "%0.0f" $value }}% of the successful builds + for {{ $labels.job }} have their duration above 2m. + - alert: CamelKSuccessBuildDuration5m + expr: | + ( + 1 - sum(rate(camel_k_build_duration_seconds_bucket{le="300",result="Succeeded"}[5m])) by (job) + / + sum(rate(camel_k_build_duration_seconds_count{result="Succeeded"}[5m])) by (job) + ) + * 100 + > 1 + for: 1m + labels: + severity: critical + annotations: + message: | + {{ printf "%0.0f" $value }}% of the successful builds + for {{ $labels.job }} have their duration above 5m. + - alert: CamelKBuildFailure + expr: | + sum(rate(camel_k_build_duration_seconds_count{result="Failed"}[5m])) by (job) + / + sum(rate(camel_k_build_duration_seconds_count[5m])) by (job) + * 100 + > 1 + for: 10m + labels: + severity: warning + annotations: + message: | + {{ printf "%0.0f" $value }}% of the builds for {{ $labels.job }} have failed. + - alert: CamelKBuildError + expr: | + sum(rate(camel_k_build_duration_seconds_count{result="Error"}[5m])) by (job) + / + sum(rate(camel_k_build_duration_seconds_count[5m])) by (job) + * 100 + > 1 + for: 10m + labels: + severity: critical + annotations: + message: | + {{ printf "%0.0f" $value }}% of the builds for {{ $labels.job }} have errored. + - alert: CamelKBuildQueueDuration1m + expr: | + ( + 1 - sum(rate(camel_k_build_queue_duration_seconds_bucket{le="60"}[5m])) by (job) + / + sum(rate(camel_k_build_queue_duration_seconds_count[5m])) by (job) + ) + * 100 + > 1 + for: 1m + labels: + severity: warning + annotations: + message: | + {{ printf "%0.0f" $value }}% of the builds for {{ $labels.job }} + have been queued for more than 1m. + - alert: CamelKBuildQueueDuration5m + expr: | + ( + 1 - sum(rate(camel_k_build_queue_duration_seconds_bucket{le="300"}[5m])) by (job) + / + sum(rate(camel_k_build_queue_duration_seconds_count[5m])) by (job) + ) + * 100 + > 1 + for: 1m + labels: + severity: critical + annotations: + message: | + {{ printf "%0.0f" $value }}% of the builds for {{ $labels.job }} + have been queued for more than 5m. \ No newline at end of file diff --git a/e2e/yaks/openshift/monitoring/yaks-config.yaml b/e2e/yaks/openshift/monitoring/yaks-config.yaml index 242ae05..b29f76b 100644 --- a/e2e/yaks/openshift/monitoring/yaks-config.yaml +++ b/e2e/yaks/openshift/monitoring/yaks-config.yaml @@ -23,7 +23,9 @@ pre: script: ./obtainToken.sh - name: Camel-k install run: | - kamel install -w -n ${YAKS_NAMESPACE} --monitoring=true + kamel install -w -n ${YAKS_NAMESPACE} + - name: Setup monitoring resources + script: ./monitoringResources.sh - name: Dependency install script: ./dependencyInstall.sh - name: Integration run