diff --git a/ci/grafana_dashboard/ocm-api-data-1659971568893.json b/ci/grafana_dashboard/ocm-api-data-1659971568893.json new file mode 100644 index 0000000..8188a96 --- /dev/null +++ b/ci/grafana_dashboard/ocm-api-data-1659971568893.json @@ -0,0 +1,1998 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + }, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 77, + "iteration": 1659971552472, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [ + { + "options": { + "False": { + "index": 0, + "text": "Success" + }, + "True": { + "index": 2, + "text": "Failure" + }, + "false": { + "index": 1, + "text": "Success" + }, + "true": { + "index": 3, + "text": "Failure" + } + }, + "type": "value" + } + ], + "unit": "none" + }, + "overrides": [ + { + "__systemRef": "hideSeriesFrom", + "matcher": { + "id": "byNames", + "options": { + "mode": "exclude", + "names": [ + "Count" + ], + "prefix": "All except:", + "readOnly": true + } + }, + "properties": [ + { + "id": "custom.hideFrom", + "value": { + "legend": false, + "tooltip": false, + "viz": true + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 37, + "options": { + "displayLabels": [ + "value", + "name" + ], + "legend": { + "displayMode": "table", + "placement": "right", + "values": [ + "value" + ] + }, + "pieType": "pie", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "has_error.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "attack.keyword: $attack AND uuid.keyword: $uuid", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "Error vs Non Error Count", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "string", + "targetField": "has_error.keyword" + } + ], + "fields": {} + } + } + ], + "type": "piechart" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-RdYlGr" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 40, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "diffperc" + ], + "fields": "/^p99\\.0 latency$/", + "values": false + }, + "textMode": "value" + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "attack.keyword", + "id": "3", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + }, + { + "field": "uuid.keyword", + "id": "4", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: $attack AND uuid.keyword: $uuid", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "P99 Percent Change", + "transformations": [ + { + "id": "sortBy", + "options": { + "fields": {}, + "sort": [ + { + "field": "p99.0 latency" + } + ] + } + } + ], + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 8 + }, + "id": 32, + "panels": [], + "title": "Latencies HeatMap", + "type": "row" + }, + { + "cards": {}, + "color": { + "cardColor": "#b4ff00", + "colorScale": "sqrt", + "colorScheme": "interpolateRdYlGn", + "exponent": 0.5, + "mode": "spectrum" + }, + "dataFormat": "timeseries", + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "heatmap": {}, + "hideZeroBuckets": false, + "highlightCards": true, + "id": 33, + "legend": { + "show": true + }, + "pluginVersion": "8.5.3", + "reverseYBuckets": false, + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "attack.keyword", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "timestamp", + "id": "4", + "settings": { + "interval": "auto", + "min_doc_count": "0", + "timeZone": "utc", + "trimEdges": "0" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: $attack", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "Latencies", + "tooltip": { + "show": true, + "showHistogram": true + }, + "type": "heatmap", + "xAxis": { + "show": true + }, + "yAxis": { + "format": "ms", + "logBase": 1, + "show": true + }, + "yBucketBound": "auto" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 41, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "attack.keyword", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "10" + }, + "type": "terms" + }, + { + "field": "timestamp", + "id": "4", + "settings": { + "interval": "auto", + "min_doc_count": "0", + "timeZone": "utc", + "trimEdges": "0" + }, + "type": "date_histogram" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "25", + "50", + "75", + "95", + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: $attack", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "Latencies", + "type": "stat" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 17 + }, + "id": 24, + "panels": [], + "title": "Endpoints P99 latencies", + "type": "row" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 14, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: resource-review AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "resource-review", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 20, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: get-current-account AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "get-current-account", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 10, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "5", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: self-terms-review AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "self-terms-review", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 22, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: cluster-authorizations AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "cluster-authorizations", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 4, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: access-review AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "access-review ", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 32 + }, + "id": 21, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: create-cluster AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "create-cluster", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 38 + }, + "id": 18, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: list-subscriptions AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "list-subscriptions", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 38 + }, + "id": 19, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "10" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: list-clusters AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "list-clusters", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 45 + }, + "id": 16, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: register-existing-cluster AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "register-existing-cluster", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 45 + }, + "id": 17, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: quota-cost AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "quota-cost", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 51 + }, + "id": 12, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: self-access-token AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "self-access-token", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 51 + }, + "id": 15, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: register-new-cluster AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "register-new-cluster", + "type": "bargauge" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 12, + "x": 0, + "y": 57 + }, + "id": 2, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "attack.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "_term", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "Endpoint", + "type": "table" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "ms" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 57 + }, + "id": 6, + "options": { + "displayMode": "basic", + "minVizHeight": 10, + "minVizWidth": 0, + "orientation": "horizontal", + "reduceOptions": { + "calcs": [], + "fields": "", + "values": true + }, + "showUnfilled": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "uuid.keyword", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1[99.0]", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "field": "latency", + "id": "1", + "settings": { + "percents": [ + "99" + ] + }, + "type": "percentiles" + } + ], + "query": "attack.keyword: certificates AND uuid.keyword: $uuid AND has_error.keyword: $error", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "certificates", + "type": "bargauge" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 71 + }, + "id": 28, + "panels": [], + "title": "Count of Status Codes", + "type": "row" + }, + { + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "displayMode": "auto", + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 0, + "y": 72 + }, + "id": 26, + "options": { + "footer": { + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "8.5.3", + "targets": [ + { + "alias": "", + "bucketAggs": [ + { + "field": "code", + "id": "2", + "settings": { + "min_doc_count": "1", + "order": "desc", + "orderBy": "1", + "size": "0" + }, + "type": "terms" + } + ], + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "metrics": [ + { + "id": "1", + "type": "count" + } + ], + "query": "has_error.keyword: $error AND attack.keyword: $attack", + "refId": "A", + "timeField": "timestamp" + } + ], + "title": "Status Code Count", + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 36, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "elasticsearch", + "uid": "2JzVqSzVk" + }, + "filters": [], + "hide": 0, + "name": "Filters", + "skipUrlSync": false, + "type": "adhoc" + }, + { + "current": { + "selected": false, + "text": "Observability - ocm-api-data", + "value": "Observability - ocm-api-data" + }, + "hide": 0, + "includeAll": false, + "label": "Datasource", + "multi": false, + "name": "Datasource", + "options": [], + "query": "elasticsearch", + "queryValue": "", + "refresh": 1, + "regex": "/.*ocm-api-data-backup*/", + "skipUrlSync": false, + "type": "datasource" + }, + { + "current": { + "selected": false, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "definition": "{\"find\": \"terms\", \"field\": \"uuid.keyword\"}", + "hide": 0, + "includeAll": true, + "label": "uuid", + "multi": true, + "name": "uuid", + "options": [], + "query": "{\"find\": \"terms\", \"field\": \"uuid.keyword\"}", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "definition": "{\"find\": \"terms\", \"field\": \"has_error.keyword\"}", + "hide": 0, + "includeAll": true, + "label": "error", + "multi": true, + "name": "error", + "options": [], + "query": "{\"find\": \"terms\", \"field\": \"has_error.keyword\"}", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "definition": "{\"find\": \"terms\", \"field\": \"code\"}", + "hide": 0, + "includeAll": true, + "label": "code", + "multi": true, + "name": "code", + "options": [], + "query": "{\"find\": \"terms\", \"field\": \"code\"}", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + }, + { + "current": { + "selected": false, + "text": [ + "list-subscriptions" + ], + "value": [ + "list-subscriptions" + ] + }, + "datasource": { + "type": "elasticsearch", + "uid": "VaQlRUz4k" + }, + "definition": "{\"find\": \"terms\", \"field\": \"attack.keyword\"}", + "hide": 0, + "includeAll": true, + "label": "attack", + "multi": true, + "name": "attack", + "options": [], + "query": "{\"find\": \"terms\", \"field\": \"attack.keyword\"}", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-5y", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "ocm-api-data", + "uid": "7w0kbHk4z", + "version": 33, + "weekStart": "" +} \ No newline at end of file diff --git a/go.mod b/go.mod index a11a271..030ef63 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.2.0 // indirect - golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect diff --git a/go.sum b/go.sum index 4a83f3e..44d15ce 100644 --- a/go.sum +++ b/go.sum @@ -140,6 +140,7 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= @@ -502,6 +503,8 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 h1:A1gGSx58LAGVHUUsOf7IiR0u8Xb6W51gRwfDBhkdcaw= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/pkg/helpers/constants.go b/pkg/helpers/constants.go index fd0da5a..edb9443 100644 --- a/pkg/helpers/constants.go +++ b/pkg/helpers/constants.go @@ -5,9 +5,9 @@ const ( DefaultAWSRegion = "us-east-1" // Cluster Auhtorization - M5XLargeResource = "m5.xlarge" AWSComputeNodeResourceType = "compute.node.aws" - DefaultClusterCount = 4 + MinClusterCount = 4 + MaxClusterCount = 10 StandardBillingModel = "standard" OsdProductID = "osd" AWSCloudProvider = "aws" @@ -17,3 +17,7 @@ const ( ClusterAuthBYOC = true SingleAvailabilityZone = "single" ) + +var ( + AWSResources = [5]string{"m3.2xlarge", "m4.large", "m4.xlarge", "m5.large", "m5.xlarge"} +) diff --git a/pkg/tests/handlers/accounts.go b/pkg/tests/handlers/accounts.go index 3f3937c..a783bbc 100644 --- a/pkg/tests/handlers/accounts.go +++ b/pkg/tests/handlers/accounts.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "fmt" + "math/rand" "net/http" "strings" "time" @@ -226,12 +227,26 @@ func TestClusterAuthorizations(ctx context.Context, options *types.TestOptions) return nil } +func randomizeResourceName() string { + resourcenamelist := helpers.AWSResources + resourceName := resourcenamelist[rand.Intn(len(resourcenamelist))] + return resourceName +} + +func randomizeCount() int { + min_count := helpers.MinClusterCount + max_count := helpers.MaxClusterCount + count := min_count + rand.Intn(max_count-min_count) + return count +} + func clusterAuthorizationsBody(ctx context.Context, clusterID string, options *types.TestOptions) []byte { + rand.Seed(time.Now().UnixNano()) buff := &bytes.Buffer{} reservedResource := v1.NewReservedResource(). - ResourceName(helpers.M5XLargeResource). + ResourceName(randomizeResourceName()). ResourceType(helpers.AWSComputeNodeResourceType). - Count(helpers.DefaultClusterCount). + Count(randomizeCount()). BillingModel(helpers.StandardBillingModel) clusterAuthReq, err := v1.NewClusterAuthorizationRequest(). diff --git a/pkg/tests/handlers/accounts_test.go b/pkg/tests/handlers/accounts_test.go new file mode 100644 index 0000000..82dae08 --- /dev/null +++ b/pkg/tests/handlers/accounts_test.go @@ -0,0 +1,100 @@ +package handlers + +import ( + "context" + "math/rand" + "strings" + "testing" + "time" + + "github.com/cloud-bulldozer/ocm-api-load/pkg/logging" + "github.com/cloud-bulldozer/ocm-api-load/pkg/types" +) + +func Test_clusterAuthorizationsBody(t *testing.T) { + type args struct { + ctx context.Context + clusterID string + options *types.TestOptions + } + logger, _ := logging.NewGoLoggerBuilder().Build() + tests := []struct { + name string + args args + }{ + + {"randomize-1", args{context.TODO(), "clusterID-1", &types.TestOptions{Logger: logger}}}, + {"randomize-2", args{context.TODO(), "clusterID-2", &types.TestOptions{Logger: logger}}}, + {"randomize-3", args{context.TODO(), "clusterID-3", &types.TestOptions{Logger: logger}}}, + {"randomize-4", args{context.TODO(), "clusterID-4", &types.TestOptions{Logger: logger}}}, + {"randomize-5", args{context.TODO(), "clusterID-5", &types.TestOptions{Logger: logger}}}, + {"randomize-6", args{context.TODO(), "clusterID-6", &types.TestOptions{Logger: logger}}}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := clusterAuthorizationsBody(tt.args.ctx, tt.args.clusterID, tt.args.options) + if got == nil { + t.Errorf("clusterAuthorizationsBody() = %v", got) + } else { + if !strings.Contains(string(got), tt.args.clusterID) { + t.Errorf("Clusterid not in body = %v, Expected = %v", string(got), tt.args.clusterID) + } + } + }) + } +} + +func Test_randomizeCount(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + tests := []struct { + name string + mincount int + maxcount int + }{ + {"Testing range of random count generated-1", 4, 10}, + {"Testing range of random count generated-2", 4, 10}, + {"Testing range of random count generated-3", 4, 10}, + {"Testing range of random count generated-4", 4, 10}, + {"Testing range of random count generated-5", 4, 10}, + {"Testing range of random count generated-6", 4, 10}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := randomizeCount() + if !(got >= tt.mincount && got <= tt.maxcount) { + t.Errorf("randomizeCount() = %v, Expected count to be within range %v and %v", got, tt.mincount, tt.maxcount) + } + }) + } +} + +func Test_randomizeResourceName(t *testing.T) { + rand.Seed(time.Now().UnixNano()) + resourcenames := [5]string{"m3.2xlarge", "m4.large", "m4.xlarge", "m5.large", "m5.xlarge"} + tests := []struct { + name string + resourcenames [5]string + }{ + {"Testing to check if output returned is from AWSResourcename-1", resourcenames}, + {"Testing to check if output returned is from AWSResourcename-2", resourcenames}, + {"Testing to check if output returned is from AWSResourcename-3", resourcenames}, + {"Testing to check if output returned is from AWSResourcename-4", resourcenames}, + {"Testing to check if output returned is from AWSResourcename-5", resourcenames}, + {"Testing to check if output returned is from AWSResourcename-6", resourcenames}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := randomizeResourceName() + result := false + for _, resourcename := range tt.resourcenames { + if resourcename == got { + result = true + break + } + } + if !result { + t.Errorf("randomizeResourceName() = %v, Expected from list %v ", got, resourcenames) + } + }) + } +}