Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENTESB-15644] Fix monitoring test #1958

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions e2e/yaks/openshift/monitoring/monitoringResources.sh
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions e2e/yaks/openshift/monitoring/resources/operator-pod-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ---------------------------------------------------------------------------
# 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: 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
145 changes: 145 additions & 0 deletions e2e/yaks/openshift/monitoring/resources/operator-prometheus-rule.yaml
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 3 additions & 1 deletion e2e/yaks/openshift/monitoring/yaks-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down