You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/08/10 03:07:06 UTC

[skywalking] branch master updated: Apply MQE on Infra-Windows layer UI-templates (#11203)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f63bfe0a4 Apply MQE on Infra-Windows layer UI-templates (#11203)
7f63bfe0a4 is described below

commit 7f63bfe0a4374f81012e4c2e711264cd3d9feb88
Author: block666 <47...@users.noreply.github.com>
AuthorDate: Thu Aug 10 11:07:00 2023 +0800

    Apply MQE on Infra-Windows layer UI-templates (#11203)
---
 docs/en/changes/changes.md                         |   1 +
 .../os_windows/windows-root.json                   |  33 +-
 .../os_windows/windows-service.json                | 396 ++++++++++++---------
 .../cases/win/expected/metrics-has-value.yml       |  26 +-
 test/e2e-v2/cases/win/win-cases.yaml               |   2 +-
 5 files changed, 253 insertions(+), 205 deletions(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 0cce700028..bad9289e9f 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -71,6 +71,7 @@
 * Apply MQE on Virtual-MQ layer UI-templates
 * Apply MQE on Infra-Linux layer UI-templates
 * Fix the wrong default value of `k8sServiceNameRule` if it's not explicitly set.
+* Apply MQE on Infra-Windows layer UI-templates
 
 #### UI
 
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-root.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-root.json
index a6625bc7f7..c3714aff89 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-root.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-root.json
@@ -1,19 +1,3 @@
-/**
- * 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.
- */
 
 [
   {
@@ -38,18 +22,24 @@
             "showYAxis": false,
             "showGroup": false
           },
-          "metrics": [
+          "expressions": [
+            "avg(meter_win_cpu_total_percentage)"
+          ],
+          "metricMode": "Expression",
+          "typesOfMQE": [
+            "TIME_SERIES_VALUES"
+          ],
+          "subExpressions": [
             "meter_win_cpu_total_percentage"
           ],
-          "metricTypes": [
-            "readMetricsValues"
+          "subTypesOfMQE": [
+            "TIME_SERIES_VALUES"
           ],
           "moved": false,
           "metricConfig": [
             {
               "label": "CPU Usage",
-              "unit": "%",
-              "calculation": "average"
+              "unit": "%"
             }
           ]
         },
@@ -85,3 +75,4 @@
     }
   }
 ]
+
diff --git a/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-service.json b/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-service.json
index 4d54eac7a3..4e9ae60be5 100644
--- a/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-service.json
+++ b/oap-server/server-starter/src/main/resources/ui-initialized-templates/os_windows/windows-service.json
@@ -1,177 +1,221 @@
-/**
- * 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.
- */
 
 [{
   "id": "Windows-Service",
   "configuration": {
-    "children": [{
-      "x": 8,
-      "y": 19,
-      "w": 8,
-      "h": 13,
-      "i": "2",
-      "type": "Widget",
-      "widget": {
-        "title": "Network Bandwidth Usage (KB/s)"
-      },
-      "graph": {
-        "type": "Area",
-        "opacity": 0.4,
-        "showXAxis": true,
-        "showYAxis": true
-      },
-      "metrics": ["meter_win_network_receive", "meter_win_network_transmit"],
-      "metricTypes": ["readMetricsValues", "readMetricsValues"]
-    }, {
-      "x": 8,
-      "y": 6,
-      "w": 8,
-      "h": 13,
-      "i": "3",
-      "type": "Widget",
-      "widget": {
-        "title": "Disk R/W (KB/s - OTEL, ops - Zabbix)"
-      },
-      "graph": {
-        "type": "Line",
-        "opacity": 0.4,
-        "showXAxis": true,
-        "showYAxis": true
-      },
-      "metrics": ["meter_win_disk_read", "meter_win_disk_written"],
-      "metricTypes": ["readMetricsValues", "readMetricsValues"],
-      "metricConfig": [{
-        "calculation": "byteToKB"
-      }, {
-        "calculation": "byteToKB"
-      }]
-    }, {
-      "x": 0,
-      "y": 6,
-      "w": 8,
-      "h": 13,
-      "i": "5",
-      "type": "Widget",
-      "widget": {
-        "title": "CPU Average Used (%)"
-      },
-      "graph": {
-        "type": "Line",
-        "step": false,
-        "smooth": false,
-        "showSymbol": true,
-        "showXAxis": true,
-        "showYAxis": true
-      },
-      "metrics": ["meter_win_cpu_average_used"],
-      "metricTypes": ["readLabeledMetricsValues"]
-    }, {
-      "x": 16,
-      "y": 6,
-      "w": 8,
-      "h": 13,
-      "i": "6",
-      "type": "Widget",
-      "widget": {
-        "title": "Memory RAM (MB)"
-      },
-      "graph": {
-        "type": "Area",
-        "opacity": 0.4,
-        "showXAxis": true,
-        "showYAxis": true
-      },
-      "metrics": ["meter_win_memory_used", "meter_win_memory_total", "meter_win_memory_available"],
-      "metricTypes": ["readMetricsValues", "readMetricsValues", "readMetricsValues"],
-      "metricConfig": [{
-        "calculation": "byteToMB"
-      }, {
-        "calculation": "byteToMB"
-      }, {
-        "calculation": "byteToMB"
-      }]
-    }, {
-      "x": 0,
-      "y": 19,
-      "w": 8,
-      "h": 13,
-      "i": "8",
-      "type": "Widget",
-      "widget": {
-        "title": "Memory Swap (MB)"
-      },
-      "graph": {
-        "type": "Area",
-        "opacity": 0.4,
-        "showXAxis": true,
-        "showYAxis": true
-      },
-      "metrics": ["meter_win_memory_swap_free", "meter_win_memory_swap_total"],
-      "metricTypes": ["readMetricsValues", "readMetricsValues"],
-      "metricConfig": [{
-        "calculation": "byteToMB"
-      }, {
-        "calculation": "byteToMB"
-      }]
-    }, {
-      "x": 16,
-      "y": 0,
-      "w": 8,
-      "h": 6,
-      "i": "9",
-      "type": "Widget",
-      "widget": {
-        "title": "Memory Swap Usage"
-      },
-      "graph": {
-        "type": "Card",
-        "fontSize": 14,
-        "textAlign": "center",
-        "showUnit": true
-      },
-      "metrics": ["meter_win_memory_swap_percentage"],
-      "metricTypes": ["readMetricsValue"],
-      "metricConfig": [{
-        "calculation": "percentage",
-        "unit": "%"
-      }]
-    }, {
-      "x": 8,
-      "y": 0,
-      "w": 8,
-      "h": 6,
-      "i": "10",
-      "type": "Widget",
-      "widget": {
-        "title": "Memory RAM Usage"
-      },
-      "graph": {
-        "type": "Card",
-        "fontSize": 14,
-        "textAlign": "center",
-        "showUnit": true
-      },
-      "metrics": ["meter_win_memory_used"],
-      "metricTypes": ["readMetricsValue"],
-      "metricConfig": [{
-        "calculation": "byteToMB",
-        "unit": "MB"
-      }]
-    }, {
+    "children": [
+      {
+        "x": 8,
+        "y": 19,
+        "w": 8,
+        "h": 13,
+        "i": "2",
+        "type": "Widget",
+        "widget": {
+          "title": "Network Bandwidth Usage (KB/s)"
+        },
+        "graph": {
+          "type": "Area",
+          "opacity": 0.4,
+          "showXAxis": true,
+          "showYAxis": true
+        },
+        "expressions": [
+          "meter_win_network_receive",
+          "meter_win_network_transmit"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES",
+          "TIME_SERIES_VALUES"
+        ]
+      },
+      {
+        "x": 8,
+        "y": 6,
+        "w": 8,
+        "h": 13,
+        "i": "3",
+        "type": "Widget",
+        "widget": {
+          "title": "Disk R/W (KB/s - OTEL, ops - Zabbix)"
+        },
+        "graph": {
+          "type": "Line",
+          "opacity": 0.4,
+          "showXAxis": true,
+          "showYAxis": true
+        },
+        "expressions": [
+          "meter_win_disk_read/1024",
+          "meter_win_disk_written/1024"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES",
+          "TIME_SERIES_VALUES"
+        ],
+        "metricConfig": [
+          {
+            "label": "read"
+          },
+          {
+            "calculation": "written"
+          }
+        ]
+      },
+      {
+        "x": 0,
+        "y": 6,
+        "w": 8,
+        "h": 13,
+        "i": "5",
+        "type": "Widget",
+        "widget": {
+          "title": "CPU Average Used (%)"
+        },
+        "graph": {
+          "type": "Line",
+          "step": false,
+          "smooth": false,
+          "showSymbol": true,
+          "showXAxis": true,
+          "showYAxis": true
+        },
+        "expressions": [
+          "meter_win_cpu_average_used"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES"
+        ]
+      },
+      {
+        "x": 16,
+        "y": 6,
+        "w": 8,
+        "h": 13,
+        "i": "6",
+        "type": "Widget",
+        "widget": {
+          "title": "Memory RAM (MB)"
+        },
+        "graph": {
+          "type": "Area",
+          "opacity": 0.4,
+          "showXAxis": true,
+          "showYAxis": true
+        },
+        "expressions": [
+          "meter_win_memory_used/1024/1024",
+          "meter_win_memory_total/1024/1024",
+          "meter_win_memory_available/1024/1024"
+        ],
+        "metricTypes": [
+          "readMetricsValues",
+          "readMetricsValues",
+          "readMetricsValues"
+        ],
+        "metricConfig": [
+          {
+            "label": "used"
+          },
+          {
+            "label": "total"
+          },
+          {
+            "label": "available"
+          }
+        ]
+      },
+      {
+        "x": 0,
+        "y": 19,
+        "w": 8,
+        "h": 13,
+        "i": "8",
+        "type": "Widget",
+        "widget": {
+          "title": "Memory Swap (MB)"
+        },
+        "graph": {
+          "type": "Area",
+          "opacity": 0.4,
+          "showXAxis": true,
+          "showYAxis": true
+        },
+        "expressions": [
+          "meter_win_memory_swap_free/1024/1024",
+          "meter_win_memory_swap_total/1024/1024"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES",
+          "TIME_SERIES_VALUES"
+        ],
+        "metricConfig": [
+          {
+            "label": "free"
+          },
+          {
+            "label": "total"
+          }
+        ]
+      },
+      {
+        "x": 16,
+        "y": 0,
+        "w": 8,
+        "h": 6,
+        "i": "9",
+        "type": "Widget",
+        "widget": {
+          "title": "Memory Swap Usage"
+        },
+        "graph": {
+          "type": "Card",
+          "fontSize": 14,
+          "textAlign": "center",
+          "showUnit": true
+        },
+        "expressions": [
+          "avg(meter_win_memory_swap_percentage/100)"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES"
+        ],
+        "metricConfig": [{
+          "unit": "%"
+        }]
+      },
+      {
+        "x": 8,
+        "y": 0,
+        "w": 8,
+        "h": 6,
+        "i": "10",
+        "type": "Widget",
+        "widget": {
+          "title": "Memory RAM Usage"
+        },
+        "graph": {
+          "type": "Card",
+          "fontSize": 14,
+          "textAlign": "center",
+          "showUnit": true
+        },
+        "expressions": [
+          "avg(meter_win_memory_used)/1024/1024"
+        ],
+        "metricMode": "Expression",
+        "typesOfMQE": [
+          "TIME_SERIES_VALUES"
+        ],
+        "metricConfig": [{
+          "unit": "MB"
+        }]
+      },
+      {
       "x": 0,
       "y": 0,
       "w": 8,
@@ -187,12 +231,18 @@
         "textAlign": "center",
         "showUnit": true
       },
-      "metrics": ["meter_win_cpu_total_percentage"],
-      "metricTypes": ["readMetricsValue"],
+      "expressions": [
+        "avg(meter_win_cpu_total_percentage)"
+      ],
+      "metricMode": "Expression",
+      "typesOfMQE": [
+        "TIME_SERIES_VALUES"
+      ],
       "metricConfig": [{
         "unit": "%"
       }]
-    }],
+    }
+    ],
     "layer": "OS_WINDOWS",
     "entity": "Service",
     "name": "Windows-Service",
diff --git a/test/e2e-v2/cases/win/expected/metrics-has-value.yml b/test/e2e-v2/cases/win/expected/metrics-has-value.yml
index 04b077dd98..dc71f56632 100644
--- a/test/e2e-v2/cases/win/expected/metrics-has-value.yml
+++ b/test/e2e-v2/cases/win/expected/metrics-has-value.yml
@@ -13,13 +13,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- contains . }}
-- key: {{ notEmpty .key }}
-  value:
-    value: 0
-    isemptyvalue: true
-- key: {{ notEmpty .key }}
-  value:
-    value: {{ ge .value.value 1 }}
-    isemptyvalue: false
-{{- end }}
+type: TIME_SERIES_VALUES
+results:
+  {{- contains .results }}
+  - metric:
+      labels: []
+    values:
+      {{- contains .values }}
+      - id: {{ notEmpty .id }}
+        value: {{ .value }}
+        traceid: null
+      - id: {{ notEmpty .id }}
+        value: null
+        traceid: null
+      {{- end}}
+  {{- end}}
+error: null
diff --git a/test/e2e-v2/cases/win/win-cases.yaml b/test/e2e-v2/cases/win/win-cases.yaml
index 3945fa9b91..279e04bfad 100644
--- a/test/e2e-v2/cases/win/win-cases.yaml
+++ b/test/e2e-v2/cases/win/win-cases.yaml
@@ -18,5 +18,5 @@
 cases:
   - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql service ls
     expected: expected/service.yml
-  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics linear --name=meter_win_memory_swap_total --service-name=10.211.55.3 | yq e 'to_entries' -
+  - query: swctl --display yaml --base-url=http://${oap_host}:${oap_12800}/graphql metrics exec --expression=meter_win_memory_swap_total --service-name=10.211.55.3
     expected: expected/metrics-has-value.yml