Copilot commented on code in PR #885:
URL: https://github.com/apache/dubbo-go-samples/pull/885#discussion_r2263326819


##########
metrics/prometheus_pull.yml:
##########
@@ -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.
+
+global:
+  evaluation_interval: 15s
+  scrape_interval: 15s
+scrape_configs:
+  - job_name: dubbo-provider
+    scrape_interval: 15s
+    scrape_timeout: 5s
+    metrics_path: /prometheus
+    static_configs:

Review Comment:
   The configuration uses 'host.docker.internal:9099' but the comment on line 
22 mentions replacing with actual IP/hostname. Consider adding a comment here 
as well to clarify this address should be updated based on deployment 
environment.
   ```suggestion
       static_configs:
         # Replace 'host.docker.internal:9099' with the actual IP address or 
hostname as appropriate for your deployment environment
   ```



##########
metrics/prometheus_pull.yml:
##########
@@ -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.
+
+global:
+  evaluation_interval: 15s
+  scrape_interval: 15s
+scrape_configs:
+  - job_name: dubbo-provider
+    scrape_interval: 15s
+    scrape_timeout: 5s
+    metrics_path: /prometheus
+    static_configs:
+      - targets: ['host.docker.internal:9099']
+  - job_name: dubbo-consumer
+    scrape_interval: 15s
+    scrape_timeout: 5s
+    metrics_path: /prometheus
+    static_configs:

Review Comment:
   Similar to line 25, this target address should have a comment indicating it 
may need to be updated based on the deployment environment.
   ```suggestion
       static_configs:
         # NOTE: This target address may need to be updated based on the 
deployment environment.
   ```



##########
metrics/grafana.json:
##########
@@ -0,0 +1,1143 @@
+{
+  "annotations": {
+    "list": [
+      {
+        "builtIn": 1,
+        "datasource": {
+          "type": "grafana",
+          "uid": "grafana"
+        },
+        "enable": true,
+        "hide": true,
+        "iconColor": "rgba(0, 211, 255, 1)",
+        "name": "Annotations & Alerts",
+        "type": "dashboard"
+      }
+    ]
+  },
+  "description": "Dubbo 服务健康状态监控大盘。流量 (Traffic), 错误 (Errors), 延迟 (Latency) 
和饱和度 (Saturation)。",
+  "editable": true,
+  "fiscalYearStartMonth": 0,
+  "graphTooltip": 0,
+  "id": 4,
+  "links": [],
+  "panels": [
+    {
+      "collapsed": false,
+      "gridPos": {
+        "h": 1,
+        "w": 24,
+        "x": 0,
+        "y": 0
+      },
+      "id": 1000,
+      "panels": [],
+      "title": "关键指标概览 (Key Metrics Overview)",
+      "type": "row"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "red",
+                "value": 0
+              },
+              {
+                "color": "green",
+                "value": 1
+              }
+            ]
+          },
+          "unit": "none"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 5,
+        "w": 4,
+        "x": 0,
+        "y": 1
+      },
+      "id": 1001,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "percentChangeColorMode": "standard",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "showPercentChange": false,
+        "textMode": "auto",
+        "wideLayout": true
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": 
"count(dubbo_application_info_total{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "在线实例 (online instances)",
+          "refId": "A"
+        }
+      ],
+      "title": "在线实例数 (Instances)",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "decimals": 2,
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              }
+            ]
+          },
+          "unit": "reqps"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 5,
+        "w": 5,
+        "x": 4,
+        "y": 1
+      },
+      "id": 1002,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "area",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "percentChangeColorMode": "standard",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "showPercentChange": false,
+        "textMode": "auto",
+        "wideLayout": true
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": 
"sum(rate(dubbo_provider_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}[$__rate_interval])) + 
sum(rate(dubbo_consumer_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\"}[$__rate_interval])) or vector(0)",
+          "legendFormat": "总QPS (Total QPS)",
+          "refId": "A"
+        }
+      ],
+      "title": "总 QPS (Total QPS)",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "decimals": 3,
+          "mappings": [],
+          "max": 100,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "red",
+                "value": 0
+              },
+              {
+                "color": "orange",
+                "value": 99
+              },
+              {
+                "color": "green",
+                "value": 99.9
+              }
+            ]
+          },
+          "unit": "percent"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 5,
+        "w": 5,
+        "x": 9,
+        "y": 1
+      },
+      "id": 1003,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "percentChangeColorMode": "standard",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "showPercentChange": false,
+        "textMode": "auto",
+        "wideLayout": true
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "(1 - 
(sum(rate(dubbo_provider_requests_failed_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}[$__rate_interval])) + 
sum(rate(dubbo_consumer_requests_failed_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}[$__rate_interval]))) / 
(sum(rate(dubbo_provider_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}[$__rate_interval])) + 
sum(rate(dubbo_consumer_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\"}[$__rate_interval])))) * 100 or vector(0)",
+          "legendFormat": "成功率 (Success Rate)",
+          "refId": "A"
+        }
+      ],
+      "title": "总体成功率 (Total Success Rate)",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "decimals": 2,
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              },
+              {
+                "color": "orange",
+                "value": 200
+              },
+              {
+                "color": "red",
+                "value": 500
+              }
+            ]
+          },
+          "unit": "ms"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 5,
+        "w": 5,
+        "x": 14,
+        "y": 1
+      },
+      "id": 1004,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "area",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "percentChangeColorMode": "standard",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "showPercentChange": false,
+        "textMode": "auto",
+        "wideLayout": true
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "editorMode": "code",
+          "expr": 
"max(dubbo_provider_rt_milliseconds_p99{application_name=~\"$application_name\",
 instance=~\"$instance\"}) or vector(0)",

Review Comment:
   The metric name 'dubbo_provider_rt_milliseconds_p99' differs from the metric 
names used in other queries (e.g., 
'dubbo_provider_rt_p99_milliseconds_aggregate' on line 716). This inconsistency 
could cause metrics to not display correctly. Verify the correct metric names 
and ensure consistency.
   ```suggestion
             "expr": 
"max(dubbo_provider_rt_p99_milliseconds_aggregate{application_name=~\"$application_name\",
 instance=~\"$instance\"}) or vector(0)",
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to