Skip to content

Commit 503d6ba

Browse files
committed
enhancement: add monitoring test to check rhoai dashboard metrics by code
1 parent 868ab73 commit 503d6ba

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

ods_ci/tests/Tests/0100__platform/0102__monitor_and_manage/0101__metrics/0101__metrics.robot

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Test Metric Existence For "Rhods_Aggregate_Availability" On ODS Prometheus
9393
@{list_values} = Create List 1 0
9494
Should Contain ${list_values} ${resp.json()["data"]["result"][0]["value"][-1]}
9595

96-
9796
Test Targets Are Available And Up In RHOAI Prometheus
9897
[Documentation] Verifies the expected targets in Prometheus are available and up running
9998
[Tags] Sanity
@@ -123,6 +122,48 @@ Test Targets Are Available And Up In RHOAI Prometheus
123122
List Should Contain Value ${targets} user_facing_endpoints_status_rhods_dashboard
124123
List Should Contain Value ${targets} user_facing_endpoints_status_workbenches
125124

125+
Test RHOAI Dashboard Metrics By Code Are Defined
126+
[Documentation] Verifies the RHOAI Dashboard Metrics By Code Are Defined and show accurate values
127+
... (2xx and 5xx codes)
128+
[Tags] Sanity
129+
... Tier1
130+
... ODS-195
131+
... RHOAIENG-13261
132+
... Monitoring
133+
Skip If RHODS Is Self-Managed
134+
${response_by_code}= Prometheus.Run Query
135+
... pm_url=${RHODS_PROMETHEUS_URL}
136+
... pm_token=${RHODS_PROMETHEUS_TOKEN}
137+
... pm_query=sum(haproxy_backend_http_responses_total {route='rhods-dashboard'}) by(code)
138+
${response_5xx}= Prometheus.Run Query
139+
... pm_url=${RHODS_PROMETHEUS_URL}
140+
... pm_token=${RHODS_PROMETHEUS_TOKEN}
141+
... pm_query=sum(haproxy_backend_http_responses_total{route='rhods-dashboard', code='5xx'})
142+
${response_2xx}= Prometheus.Run Query
143+
... pm_url=${RHODS_PROMETHEUS_URL}
144+
... pm_token=${RHODS_PROMETHEUS_TOKEN}
145+
... pm_query=sum(haproxy_backend_http_responses_total{route='rhods-dashboard', code='2xx'})
146+
${response_total}= Prometheus.Run Query
147+
... pm_url=${RHODS_PROMETHEUS_URL}
148+
... pm_token=${RHODS_PROMETHEUS_TOKEN}
149+
... pm_query=sum(haproxy_backend_http_responses_total{route='rhods-dashboard'}
150+
151+
@{metrics_by_code}= Set Variable ${response_by_code.json()["data"]["result"]}
152+
${metrics_by_code_5xx}= Set Variable ${metrics_by_code[4]["value"][-1]}
153+
${metrics_by_code_5xx}= Convert To Number ${metrics_by_code_5xx} 2
154+
${metrics_by_code_2xx}= Set Variable ${metrics_by_code[1]["value"][-1]}
155+
${metrics_by_code_2xx}= Convert To Number ${metrics_by_code_2xx} 2
156+
${metrics_5xx}= Set Variable ${response_5xx.json()["data"]["result"][0]["value"][-1]}
157+
${metrics_5xx}= Convert To Number ${metrics_5xx} 2
158+
${metrics_2xx}= Set Variable ${response_2xx.json()["data"]["result"][0]["value"][-1]}
159+
${metrics_2xx}= Convert To Number ${metrics_2xx} 2
160+
${metrics_total}= Set Variable ${response_total.json()["data"]["result"][0]["value"][-1]}
161+
${metrics_total}= Convert To Number ${metrics_total} 2
162+
163+
Should Match ${metrics_by_code_5xx} ${metrics_5xx}
164+
Should Match ${metrics_by_code_2xx} ${metrics_2xx}
165+
Should Match ${metrics_total} ${metrics_by_code_5xx}+${metrics_by_code_2xx}
166+
126167

127168
*** Keywords ***
128169
Begin Metrics Web Test

0 commit comments

Comments
 (0)