From: Murali Parthasarathy K Date: Wed, 7 May 2025 07:47:06 +0000 (+0200) Subject: Update CSIT with new prometheus metrics changes X-Git-Tag: 4.2.0~9 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F140716%2F1;p=policy%2Fdocker.git Update CSIT with new prometheus metrics changes Issue-ID: POLICY-5352 Change-Id: Ia372f7a193df2108cc388a2c0c324e9d4c207cc1 Signed-off-by: Murali Parthasarathy K --- diff --git a/compose/metrics/dashboards/dashboard-opa-pdp.json b/compose/metrics/dashboards/dashboard-opa-pdp.json index 771c994c..cf5a2030 100644 --- a/compose/metrics/dashboards/dashboard-opa-pdp.json +++ b/compose/metrics/dashboards/dashboard-opa-pdp.json @@ -25,7 +25,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 6, + "id": null, "links": [], "liveNow": false, "panels": [ @@ -41,15 +41,14 @@ "x": 0, "y": 0 }, - "id": 19, + "id": 1, "panels": [], "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" - }, - "refId": "A" + } } ], "title": "Quick Info", @@ -91,7 +90,7 @@ "x": 0, "y": 1 }, - "id": 4, + "id": 2, "options": { "colorMode": "value", "graphMode": "none", @@ -123,8 +122,7 @@ "format": "time_series", "instant": false, "interval": "", - "legendFormat": "process_uptime: {{pod}}", - "refId": "A" + "legendFormat": "process_uptime: {{pod}}" } ], "title": "Process Uptime", @@ -196,7 +194,7 @@ "x": 6, "y": 1 }, - "id": 26, + "id": 3, "options": { "minVizHeight": 75, "minVizWidth": 75, @@ -223,8 +221,7 @@ "exemplar": true, "expr": "irate(process_cpu_seconds_total{job=\"opa-pdp-metrics\"}[$__range]) * 100", "interval": "", - "legendFormat": "{{pod}}", - "refId": "A" + "legendFormat": "{{pod}}" } ], "title": "CPU Usage", @@ -298,7 +295,7 @@ "x": 12, "y": 1 }, - "id": 27, + "id": 4, "options": { "minVizHeight": 75, "minVizWidth": 75, @@ -325,8 +322,7 @@ "expr": "100 * process_resident_memory_bytes{job=\"opa-pdp-metrics\"} / (1024 * 1024 * 1024)", "hide": false, "interval": "", - "legendFormat": "RSS : {{ pod }}", - "refId": "A" + "legendFormat": "RSS : {{ pod }}" } ], "title": "Memory Usage", @@ -342,20 +338,19 @@ "h": 1, "w": 24, "x": 0, - "y": 7 + "y": 26 }, - "id": 17, + "id": 5, "panels": [], "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" - }, - "refId": "A" + } } ], - "title": "System", + "title": "Requests", "type": "row" }, { @@ -363,47 +358,12 @@ "type": "prometheus", "uid": "dkSf71fnz" }, - "description": "Policy OPA-PDP CPU Usage Monitoring", + "description": "Policy Decisions Total for OPA-PDP per instance", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, "mappings": [], "thresholds": { "mode": "absolute", @@ -418,130 +378,63 @@ } ] }, - "unit": "percent" + "unit": "none" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "process-1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "process_1h: dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] + "overrides": [] }, "gridPos": { - "h": 9, - "w": 8, + "h": 8, + "w": 10, "x": 0, - "y": 8 + "y": 27 }, - "id": 2, + "id": 6, "options": { - "legend": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "auto", + "reduceOptions": { "calcs": [ - "max", - "mean", - "last" + "lastNotNull" ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Max", - "sortDesc": true + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, - "editorMode": "code", "exemplar": true, - "expr": "irate(process_cpu_seconds_total{job=\"opa-pdp-metrics\"}[$__range])*100", + "expr": "opa_decision_response_time_seconds_count{instance=\"policy-opa-pdp:8282\", job=\"opa-pdp-metrics\"}", + "hide": false, "interval": "", - "legendFormat": "opa: {{pod}}", - "range": true, - "refId": "A" + "legendFormat": "Decision Count" } ], - "title": "CPU Usage", - "type": "timeseries" + "title": "Policy Decisions", + "type": "bargauge" }, { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, - "description": "Policy OPA-PDP Memory Usage Monitoring", + "description": "Dynamic Data Patch Total for OPA-PDP per instance", "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineStyle": { - "fill": "solid" - }, - "lineWidth": 1, - "pointSize": 1, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, "mappings": [], "thresholds": { "mode": "absolute", @@ -556,182 +449,209 @@ } ] }, - "unit": "percent" + "unit": "none" }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "{area=\"heap\", container=\"policy-api\", endpoint=\"policy-api\", id=\"Tenured Gen\", instance=\"10.42.7.19:6969\", job=\"policy-api\", namespace=\"onap\", pod=\"dev-policy-api-69f54f45cc-sb56v\", service=\"policy-api\"}" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "text", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Tenured Gen - dev-policy-api-69f54f45cc-wq6xq" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "dark-purple", - "mode": "fixed" - } - } - ] - } - ] + "overrides": [] }, "gridPos": { - "h": 9, - "w": 7, - "x": 8, - "y": 8 + "h": 8, + "w": 10, + "x": 10, + "y": 27 }, - "id": 13, + "id": 7, "options": { - "legend": { + "displayMode": "gradient", + "maxVizHeight": 300, + "minVizHeight": 16, + "minVizWidth": 8, + "namePlacement": "auto", + "orientation": "auto", + "reduceOptions": { "calcs": [ - "max", - "mean", - "last" + "lastNotNull" ], - "displayMode": "table", - "placement": "bottom", - "showLegend": true, - "sortBy": "Last", - "sortDesc": false + "fields": "", + "values": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showUnfilled": true, + "sizing": "auto", + "valueMode": "color" }, + "pluginVersion": "11.1.0", "targets": [ { "datasource": { "type": "prometheus", "uid": "dkSf71fnz" }, - "editorMode": "code", "exemplar": true, - "expr": "100 * process_resident_memory_bytes{job=\"opa-pdp-metrics\"} / (1024 * 1024 * 1024)", + "expr": "opa_data_response_time_seconds_count{instance=\"policy-opa-pdp:8282\", job=\"opa-pdp-metrics\"}", "hide": false, "interval": "", - "legendFormat": "Alloc : {{ pod }}", - "range": true, - "refId": "A" + "legendFormat": "Dynamic Data(Patch) Count" } ], - "title": "Memory Usage", - "type": "timeseries" + "title": "Dynamic Data for policies", + "type": "bargauge" }, { - "collapsed": false, - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, + "type": "timeseries", + "title": "Policy Deployment Success", + "targets": [ + { + "expr": "rate(pdpo_policy_deployments_total[5m])", + "legendFormat": "deployments" + }, + { + "expr": "rate(pdpo_policy_undeployments_success_total[5m])", + "legendFormat": "undeployments_success" + } + ], "gridPos": { - "h": 1, - "w": 24, "x": 0, - "y": 26 + "y": 28, + "w": 10, + "h": 8 }, - "id": 21, - "panels": [], + "id": 8, + "options": { + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center" + } + }, + { + "type": "timeseries", + "title": "Policy Deployment Failures", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "refId": "A" + "expr": "rate(pdpo_policy_failures_total[5m])", + "legendFormat": "deployment_failures" + }, + { + "expr": "rate(pdpo_policy_undeployments_failures_total[5m])", + "legendFormat": "undeployment_failures" } ], - "title": "Requests", - "type": "row" + "gridPos": { + "x": 10, + "y": 28, + "w": 10, + "h": 8 + }, + "id": 9, + "options": { + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center" + } }, { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" + "type": "stat", + "title": "Total Policy Decisions", + "targets": [ + { + "expr": "sum(pdpo_policy_decisions_total)", + "legendFormat": "decisions" + } + ], + "gridPos": { + "x": 0, + "y": 30, + "w": 20, + "h": 8 }, - "description": "Policy Decisions Total for OPA-PDP per instance", - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" + "id": 10, + "options": { + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false }, - "overrides": [] - }, + "orientation": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center" + } + }, + { + "type": "stat", + "title": "Dynamic Data Successful in Updates", + "targets": [ + { + "expr": "sum(pdpo_dynamic_data_success_total)", + "legendFormat": "dynamic_updates_success" + } + ], "gridPos": { - "h": 8, - "w": 12, "x": 0, - "y": 27 + "y": 29, + "w": 10, + "h": 8 }, - "id": 30, + "id": 11, "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "auto", "reduceOptions": { "calcs": [ - "lastNotNull" + "last" ], "fields": "", "values": false }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" - }, - "pluginVersion": "11.1.0", + "orientation": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center" + } + }, + { + "type": "stat", + "title": "Dynamic Data Update Failures", "targets": [ { - "datasource": { - "type": "prometheus", - "uid": "dkSf71fnz" - }, - "exemplar": true, - "expr": "opa_decision_response_time_seconds_count{instance=\"policy-opa-pdp:8282\", job=\"opa-pdp-metrics\"}", - "hide": false, - "interval": "", - "legendFormat": "Decision Count", - "refId": "B" + "expr": "sum(pdpo_dynamic_data_failures_total)", + "legendFormat": "dynamic_updates_failures" } ], - "title": "Policy Decisions", - "type": "bargauge" + "gridPos": { + "x": 10, + "y": 29, + "w": 10, + "h": 8 + }, + "id": 11, + "options": { + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "orientation": "auto", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "center" + } } ], "refresh": "", diff --git a/csit/resources/tests/opa-pdp-test.robot b/csit/resources/tests/opa-pdp-test.robot index 98e413c4..2eb44665 100644 --- a/csit/resources/tests/opa-pdp-test.robot +++ b/csit/resources/tests/opa-pdp-test.robot @@ -37,11 +37,11 @@ ValidatesVehiclePolicy ${URL_CONTEXT}= Set Variable node/vehicle ${DYNAMIC_URL}= Set Variable ${DATA_URL}${URL_CONTEXT} ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-vehicle-output.json data - ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-add.json 204 + ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-add.json 204 202 ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.dyn-data-add-output.json data - ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-replace.json 204 + ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-replace.json 204 202 ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.dyn-data-replace-output.json data - ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 204 + ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 204 202 ValidateGetDynamicData ${DYNAMIC_URL} 200 onap.policy.opa.pdp.policy-vehicle-output.json data ValidatePolicyResponse onap.policy.policy.opa.pdp.decision.vehicle_input.json 200 onap.policy.policy.opa.pdp.decision.vehicle_output.json ValidateIncorrectPolicyNameResponse onap.policy.policy.opa.pdp.decision.vehicle-incorect-policyname.json 400 @@ -49,7 +49,7 @@ ValidatesVehiclePolicy UndeployOpaPolicy /policy/pap/v1/pdps/policies/vehicle 202 UndeployOpaPolicy /policy/pap/v1/pdps/policies/vehicle 400 ValidateGetDynamicData ${DYNAMIC_URL} 404 onap.policy.opa.pdp.policy-resource-not-found.json responseCode - ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 400 + ValidatePatchDynamicData ${DYNAMIC_URL} onap.policy.opa.pdp.dyn-data-remove.json 400 400 ValidatesAbacPolicy CreateOpaPolicy onap.policy.opa.pdp.policy-abac-create.yaml abac 1.0.2 201 @@ -131,12 +131,17 @@ ValidateGetDynamicData ValidatePatchDynamicData [Documentation] Validating the output for the policy - [Arguments] ${dyn_url} ${jsonfile} ${status} - ${expectedStatus}= Set Variable ${status} + [Arguments] ${dyn_url} ${jsonfile} ${status} ${status1} + ${Accepted}= Set Variable ${status} + ${NoContent}= Set Variable ${status1} ${patchjson}= Get file ${CURDIR}/data/${jsonfile} ${hcauth}= PolicyAdminAuth - ${resp}= PerformPatchRequest ${POLICY_OPA_IP} ${dyn_url} ${expectedStatus} ${patchjson} abbrev=true ${hcauth} - Should Be Equal As Integers ${resp.status_code} ${expectedStatus} + ${resp}= PerformPatchRequest ${POLICY_OPA_IP} ${dyn_url} ${Accepted} ${patchjson} abbrev=true ${hcauth} + IF ${resp.status_code} == ${Accepted} or ${resp.status_code} == ${NoContent} + Log Status is acceptable + ELSE + Fail Unexpected status code: ${resp.status_code} + END ValidatePolicyResponseWithoutFilter [Documentation] Validating the output for the policy