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

alexstocks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new 5b0f7f37 feat: add Prometheus push and pull mode monitoring setup with 
Grafana and Pushgateway (#885)
5b0f7f37 is described below

commit 5b0f7f3769f69e47e84c230df1eda4c59a3322f7
Author: Xuetao Li <[email protected]>
AuthorDate: Sat Aug 9 15:34:46 2025 +0800

    feat: add Prometheus push and pull mode monitoring setup with Grafana and 
Pushgateway (#885)
    
    * feat: add Prometheus monitoring setup with Grafana and Pushgateway
    
    * feat: add Prometheus monitoring setup with Grafana and Pushgateway
    
    * fix: update Prometheus query expressions in Grafana configuration
---
 README.md                            |    2 +-
 README_CN.md                         |    2 +-
 metrics/README.md                    |  253 ++++----
 metrics/README_CN.md                 |  180 ++++++
 metrics/README_zn.md                 |  141 -----
 metrics/assert/dashboard.png         |  Bin 250099 -> 0 bytes
 metrics/assert/datasource.png        |  Bin 97773 -> 0 bytes
 metrics/assert/grafana.png           |  Bin 0 -> 948366 bytes
 metrics/assert/import-datasource.png |  Bin 91148 -> 0 bytes
 metrics/assert/import-json.png       |  Bin 104299 -> 0 bytes
 metrics/assert/import.png            |  Bin 65239 -> 0 bytes
 metrics/assert/podmonitor.png        |  Bin 85451 -> 0 bytes
 metrics/docker-compose.yml           |   45 ++
 metrics/go-client/cmd/main.go        |    8 +-
 metrics/grafana.json                 | 1143 ++++++++++++++++++++++++++++++++++
 metrics/prometheus_pull.yml          |   31 +
 metrics/prometheus_push.yml          |   23 +
 17 files changed, 1570 insertions(+), 258 deletions(-)

diff --git a/README.md b/README.md
index 45fbfd17..dc0ff949 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,7 @@
 * java_interop: Demonstrates interoperability between Java and Go Dubbo 
implementations
 * llm: Example of integrating large language models (LLM) with Dubbo-go
 * logger: Logging examples for Dubbo-go applications
-* metrics: How to collect and expose metrics from Dubbo-go services
+* metrics: How to collect and expose metrics from Dubbo-go services, 
supporting both Prometheus Push and Pull modes
 * online_boutique: Microservices online boutique demo using Dubbo-go
 * otel/tracing: Distributed tracing example using OpenTelemetry
 * registry: Examples of using different service registries (e.g., nacos, 
zookeeper)
diff --git a/README_CN.md b/README_CN.md
index 919728bc..52fb7790 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -42,7 +42,7 @@
 * java_interop:Java 与 Go Dubbo 实现互操作示例
 * llm:集成大语言模型(LLM)与 Dubbo-go 示例
 * logger:Dubbo-go 日志功能示例
-* metrics:Dubbo-go 服务指标采集与暴露示例
+* metrics:Dubbo-go 服务指标采集与暴露示例,支持 Prometheus Push 模式和 Pull 模式
 * online_boutique:Dubbo-go 微服务电商示例
 * otel/tracing:基于 OpenTelemetry 的分布式链路追踪示例
 * registry:多种服务注册中心(如 nacos、zookeeper)用法示例
diff --git a/metrics/README.md b/metrics/README.md
index 780047e5..690355fe 100644
--- a/metrics/README.md
+++ b/metrics/README.md
@@ -1,139 +1,174 @@
-# metrics for dubbo-go
+# Dubbo-Go Metrics Monitoring Example
 
-This example demonstrates the metrics usage of dubbo-go as an RPC framework. 
Check [Quick 
Start](https://cn.dubbo.apache.org/en/overview/mannual/golang-sdk/quickstart/) 
on our official website for detailed explanation.
+English | [中文](README_CN.md)
 
-## Contents
+This example demonstrates how to use the Push and Pull modes of **Prometheus 
Pushgateway** to monitor a Dubbo-Go application and visualize the data with 
Grafana.
 
-- server/main.go - is the main definition of the service, handler and rpc 
server
-- client/main.go - is the rpc client
-- proto - contains the protobuf definition of the API
+-----
 
-## How to run
+## Core Architecture
 
-### Run server
-```shell
-go run ./go-server/cmd/main.go
+The monitoring data flow is as follows:
+
+**Push Mode: Application (go-client / go-server) -> Prometheus Pushgateway -> 
Prometheus -> Grafana**
+
+**Pull Mode: Application (go-client / go-server) -> Prometheus -> Grafana**
+
+## Included Components
+
+| Component | Port | Description |
+| :--- | :--- | :--- |
+| **Grafana** | `3000` | A dashboard for visualizing metrics. |
+| **Prometheus** | `9090` | Responsible for storing and querying metric data. 
It pulls data from the Pushgateway. |
+| **Pushgateway** | `9091` | Used to receive metrics pushed from the Dubbo-Go 
application. |
+| **go-server** | N/A | Dubbo-Go service provider (Provider) example. |
+| **go-client** | N/A | Dubbo-Go service consumer (Consumer) example that 
continuously calls the server. |
+
+## 🚀 Quick Start
+
+Please follow the steps below to run this example.
+
+### Prerequisites:
+
+- Please configure the network addresses in `prometheus_pull.yml`, 
`prometheus_push.yml`, `go-client/cmd/main.go`, and `go-server/cmd/main.go` 
according to your actual network environment.
+- If you want to try the Push mode, change line 38 in `docker-compose.yml` 
from `- ./prometheus_pull.yml:/etc/prometheus/prometheus.yml` to `- 
./prometheus_push.yml:/etc/prometheus/prometheus.yml`, and then restart the 
services.
+
+### Step 1: Start the Monitoring Stack
+
+First, start the Grafana, Prometheus, and Pushgateway services. We use 
`docker-compose` to do this with a single command.
+
+```bash
+# Enter the metrics directory
+cd metrics
+# Start all monitoring services in the background
+docker-compose up -d
 ```
 
-test server work as expected:
-```shell
-curl \
-    --header "Content-Type: application/json" \
-    --data '{"name": "Dubbo"}' \
-    http://localhost:20000/greet.GreetService/Greet
+You can now access the web UI for each service at the following addresses:
+
+- **Grafana**: `http://localhost:3000`
+- **Prometheus**: `http://localhost:9090`
+- **Pushgateway**: `http://localhost:9091`
+
+### Step 2: Start the Dubbo-Go Server
+
+In the metrics directory, open a new terminal window and run the server 
program.
+
+```bash
+go run ./go-server/cmd/main.go
 ```
 
-### Run client
-```shell
+You will see logs indicating that the server has started successfully and 
registered its services.
+
+### Step 3: Start the Dubbo-Go Client
+
+In the metrics directory, open another new terminal window and run the client 
program. The client will continuously call the server's methods, with random 
failures to generate monitoring metrics.
+
+```bash
 go run ./go-client/cmd/main.go
 ```
 
-## deploy to local
-install prometheus and open prometheus config file `prometheus.yml`, write the 
config like this
-
-```yaml
-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: ['localhost:9099']
-- job_name: dubbo-consumer
-  scrape_interval: 15s
-  scrape_timeout: 5s
-  metrics_path: /prometheus
-  static_configs:
-    - targets: ['localhost:9097']
-```
+The client will start printing call results while pushing monitoring metrics 
to the Pushgateway. You can see the pushed metrics on the Pushgateway UI 
(`http://localhost:9091/metrics`).
 
-install grafana and open grafana web page like `localhost:3000`
+### Step 4: Configure Grafana and Import the Dashboard
 
-open: 【Home / Connections / Data sources】
+Now that all services are running, let's configure Grafana to display the data.
 
-click 【Add new data source】
+#### 4.1. Add Prometheus Data Source
 
-select Prometheus
+1.  Open the Grafana website: 
[`http://localhost:3000`](https://www.google.com/search?q=http://localhost:3000)
 (default username/password: `admin`/`admin`).
+2.  In the left-side menu, navigate to **Home -> Connections -> Data sources**.
+3.  Click the **[Add new data source]** button.
+4.  Select **Prometheus**.
+5.  In the **Prometheus server URL** field, enter 
`http://host.docker.internal:9090`.
+    > **Note**: `host.docker.internal` is a special DNS name that allows 
Docker containers (like Grafana) to access the host machine's network. You can 
configure it according to your actual situation.
+6.  Click the **[Save & test]** button at the bottom. You should see a "Data 
source is working" success message.
 
-enter 【Prometheus server URL】 like `http://localhost:9090` and click 【Save & 
test】
+#### 4.2. Import the Dubbo Monitoring Dashboard
 
-![datasource.png](./assert/datasource.png)
+1.  In the left-side menu, navigate to **Home -> Dashboards**.
+2.  Click **[New]** -> **[Import]** in the top right corner.
+3.  Copy the contents of `grafana.json` into the **Import via panel json** 
text box, or click the **Upload JSON file** button to upload the `grafana.json` 
file.
+4.  On the next page, make sure to select the Prometheus data source we just 
created for the dashboard.
+5.  Click the **[Import]** button.
 
-open 【Home / Dashboards 】click 【New】【import】and enter 19294 click Load
+### Step 5: View the Monitoring Dashboard
 
-![import](./assert/import.png)
+After a successful import, you will see a complete Dubbo observability 
dashboard\! The data in the panels (like QPS, success rate, latency, etc.) will 
update dynamically as the client continues to make calls.
 
-if your grafana can't access internet you can open 
`https://grafana.com/grafana/dashboards/19294-dubbo-observability/` and click 
【Download JSON】
+Enjoy\!
 
-paste the JSON
+## Troubleshooting
 
-![json.png](./assert/import-json.png)
+- **Grafana dashboard shows "No Data"**
 
-![datasource.png](./assert/import-datasource.png)
+   - Verify that the Prometheus data source URL 
(`http://host.docker.internal:9090`) is correct and that the connection test 
was successful.
+   - Go to the Prometheus UI (`http://localhost:9090`), and check the `Status 
-> Targets` page to ensure the `pushgateway` job has a status of **UP**.
+   - In the Prometheus query bar, enter 
`dubbo_consumer_requests_succeed_total` to confirm that data can be queried.
 
-click 【Import】button and you will see the Dubbo Observability dashboard,enjoy 
it
+- **Cannot connect to `host.docker.internal`**
 
-![databoard](./assert/dashboard.png)
+   - `host.docker.internal` is a built-in feature of Docker. If this address 
is not accessible, replace the IP address in `metrics/prometheus.yml` and the 
Grafana data source address with your actual IP address.
 
-## Deploy to Kubernetes
+-----
 
-#### kube-prometheus
+## Deploying to Kubernetes
 
-install prometheus in k8s 
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus)
-
-Set `prometheus-service.yaml` type to NodePort
-
-1. add `dubboPodMoitor.yaml` to  `kube-prometheus` `manifests` dir, The 
content is as follows
- ```yaml
-apiVersion: monitoring.coreos.com/v1
-kind: PodMonitor
-metadata:
-  name: podmonitor
-  labels:
-    app: podmonitor
-  namespace: monitoring
-spec:
-  namespaceSelector:
-    matchNames:
-      - dubbo-system
-  selector:
-    matchLabels:
-      app-type: dubbo
-  podMetricsEndpoints:
-    - port: metrics # ref to dubbo-app port name metrics
-      path: /prometheus
----
-# rbac
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
-metadata:
-  namespace: dubbo-system
-  name: pod-reader
-rules:
-  - apiGroups: [""]
-    resources: ["pods"]
-    verbs: ["get", "list", "watch"]
-
----
-# rbac
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
-  name: pod-reader-binding
-  namespace: dubbo-system
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: Role
-  name: pod-reader
-subjects:
-  - kind: ServiceAccount
-    name: prometheus-k8s
-    namespace: monitoring
-```
-2. `kubectl apply -f Deployment.yaml`
-3. open prometheus web page such as http://localhost:9090/targets
-   ![podmonitor.png](./assert/podmonitor.png)
+#### kube-prometheus
 
+To install Prometheus in Kubernetes (k8s), please refer to the 
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus) 
project.
+
+Set the service type in `prometheus-service.yaml` to `NodePort`.
+
+1.  Add the `dubboPodMoitor.yaml` file to the `manifests` directory of 
`kube-prometheus` with the following content:
+
+    ```yaml
+    apiVersion: monitoring.coreos.com/v1
+    kind: PodMonitor
+    metadata:
+      name: podmonitor
+      labels:
+        app: podmonitor
+      namespace: monitoring
+    spec:
+      namespaceSelector:
+        matchNames:
+          - dubbo-system
+      selector:
+        matchLabels:
+          app-type: dubbo
+      podMetricsEndpoints:
+        - port: metrics # Reference the port name 'metrics' of the dubbo-app
+          path: /prometheus
+    ---
+    # Role-Based Access Control (RBAC)
+    apiVersion: rbac.authorization.k8s.io/v1
+    kind: Role
+    metadata:
+      namespace: dubbo-system
+      name: pod-reader
+    rules:
+      - apiGroups: [ "" ]
+        resources: [ "pods" ]
+        verbs: [ "get", "list", "watch" ]
+
+    ---
+    # Role-Based Access Control (RBAC)
+    apiVersion: rbac.authorization.k8s.io/v1
+    kind: RoleBinding
+    metadata:
+      name: pod-reader-binding
+      namespace: dubbo-system
+    roleRef:
+      apiGroup: rbac.authorization.k8s.io
+      kind: Role
+      name: pod-reader
+    subjects:
+      - kind: ServiceAccount
+        name: prometheus-k8s
+        namespace: monitoring
+    ```
+
+2.  Execute `kubectl apply -f Deployment.yaml`
+
+3.  Open the Prometheus web interface, for example, 
`http://localhost:9090/targets`
\ No newline at end of file
diff --git a/metrics/README_CN.md b/metrics/README_CN.md
new file mode 100644
index 00000000..bdf9a579
--- /dev/null
+++ b/metrics/README_CN.md
@@ -0,0 +1,180 @@
+# Dubbo-Go 指标监控示例
+
+[English](README.md) | 中文
+
+本示例演示了如何使用 **Prometheus Pushgateway** 的Push和Pull模式来监控 Dubbo-Go 应用程序,并通过 
Grafana 进行可视化展示。
+
+
+---
+
+## 核心架构
+
+监控数据流如下:
+
+**Push 模式:应用 (go-client / go-server) -> Prometheus Pushgateway -> Prometheus 
-> Grafana**
+
+**Pull 模式:应用 (go-client / go-server) -> Prometheus -> Grafana**
+
+## 包含组件
+
+| 组件              | 端口     | 描述                                     |
+|:----------------|:-------|:---------------------------------------|
+| **Grafana**     | `3000` | 用于指标可视化的仪表盘。                           |
+| **Prometheus**  | `9090` | 负责存储和查询指标数据,它会从 Pushgateway 拉取数据。      |
+| **Pushgateway** | `9091` | 用于接收来自 Dubbo-Go 应用推送的指标数据。             |
+| **go-server**   | N/A    | Dubbo-Go 服务提供者 (Provider) 示例。          |
+| **go-client**   | N/A    | Dubbo-Go 服务消费者 (Consumer) 示例,会持续调用服务端。 |
+
+## 🚀 快速开始
+
+请按照以下步骤来运行此示例。
+
+### 前提条件:
+
+- 请根据实际的网络情况配置 
`prometheus_pull.yml`、`prometheus_push.yml`、`go-client/cmd/main.go`、`go-server/cmd/main.go`
+  中的网络地址。
+- 如果您想体验Push模式,请将 `docker-compose.yml` 第 38 行的 `- 
./prometheus_pull.yml:/etc/prometheus/prometheus.yml` 改为
+  `- ./prometheus_push.yml:/etc/prometheus/prometheus.yml`,然后重新启动服务。
+
+### 步骤 1: 启动监控服务栈
+
+首先,启动 Grafana, Prometheus 和 Pushgateway 服务。我们使用 `docker-compose` 来一键完成。
+
+```bash
+# 进入 metrics 目录
+cd metrics
+# 以后台模式启动所有监控服务
+docker-compose up -d
+```
+
+您现在可以通过以下地址访问各个服务的 Web UI:
+
+- **Grafana**: `http://localhost:3000`
+- **Prometheus**: `http://localhost:9090`
+- **Pushgateway**: `http://localhost:9091`
+
+### 步骤 2: 启动 Dubbo-Go 服务端
+
+在metrics目录,新开一个终端窗口,运行服务端程序。
+
+```bash
+go run ./go-server/cmd/main.go
+```
+
+您会看到服务端成功启动并注册服务的日志。
+
+### 步骤 3: 启动 Dubbo-Go 客户端
+
+在metrics目录,再次新开一个终端窗口,运行客户端程序。客户端会循环调用服务端的方法,并且会随机失败,从而产生监控指标。
+
+```bash
+go run ./go-client/cmd/main.go
+```
+
+客户端将开始输出调用结果,同时将监控指标推送到 Pushgateway。您可以在 Pushgateway 的 UI 
(`http://localhost:9091/metrics`)
+上看到推送上来的指标。
+
+### 步骤 4: 配置 Grafana 并导入大盘
+
+现在,所有服务都已运行,我们来配置 Grafana 以展示数据。
+
+#### 4.1. 添加 Prometheus 数据源
+
+1. 打开 Grafana 网站:[`http://localhost:3000`](http://localhost:3000) (默认用户名/密码: 
`admin`/`admin`)。
+2. 在左侧菜单中,导航至 **Home -> Connections -> Data sources**。
+3. 点击 **【Add new data source】** 按钮。
+4. 选择 **Prometheus**。
+5. 在 **Prometheus server URL** 字段中,输入 `http://host.docker.internal:9090`。
+   > **Note**: `host.docker.internal` 是一个特殊的 DNS 名称,它允许 Docker 容器(如 
Grafana)访问宿主机的网络,您可以根据实际情况进行配置。
+6. 点击底部的 **【Save & test】** 按钮,您应该会看到 "Data source is working" 的成功提示。
+
+#### 4.2. 导入 Dubbo 监控大盘
+
+1. 在左侧菜单中,导航至 **Home -> Dashboards**。
+2. 点击右上角的 **【New】** -> **【Import】**。
+3. 将 `grafana.json` 的内容复制到 **Import via panel json** 文本框中,或者点击 **Upload JSON 
file** 按钮上传 `grafana.json` 文件。
+4. 在下一个页面中,确保为大盘选择我们刚刚创建的 Prometheus 数据源。
+5. 点击 **【Import】** 按钮。
+
+### 步骤 5: 查看监控大盘
+
+导入成功后,您将看到一个完整的 Dubbo 可观测性大盘!面板中的数据(如QPS、成功率、延迟等)会随着客户端的持续调用而动态更新。
+
+![grafana.png](assert/grafana.png)
+
+尽情使用吧!
+
+## 常见问题 (Troubleshooting)
+
+- **Grafana 大盘显示 "No Data"**
+    - 请确认 Prometheus 数据源的 URL (`http://host.docker.internal:9090`) 是否正确且测试连接成功。
+    - 访问 Prometheus UI (`http://localhost:9090`),在 `Status -> Targets` 页面检查 
`pushgateway` 任务是否为 **UP** 状态。
+    - 在 Prometheus 的查询栏中输入 `dubbo_consumer_requests_succeed_total`,确认能查询到数据。
+
+- **`host.docker.internal` 无法连接**
+    - `host.docker.internal` 是 Docker 的内置功能,如果该地址无法访问,请将 
`metrics/prometheus.yml`
+      中的Ip地址以及Grafana的数据源地址换为实际的Ip地址。
+      好的,这是您提供内容的中文翻译。
+
+-----
+
+## 部署到 Kubernetes
+
+#### kube-prometheus
+
+在 Kubernetes (k8s) 中安装 prometheus,请参考 
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus) 项目。
+
+将 `prometheus-service.yaml` 的服务类型(type)设置为 `NodePort`。
+
+1.  将 `dubboPodMoitor.yaml` 文件添加到 `kube-prometheus` 的 `manifests` 目录下,内容如下:
+
+    ```yaml
+    apiVersion: monitoring.coreos.com/v1
+    kind: PodMonitor
+    metadata:
+      name: podmonitor
+      labels:
+        app: podmonitor
+      namespace: monitoring
+    spec:
+      namespaceSelector:
+        matchNames:
+          - dubbo-system
+      selector:
+        matchLabels:
+          app-type: dubbo
+      podMetricsEndpoints:
+        - port: metrics # 引用 dubbo-app 的端口名称 metrics
+          path: /prometheus
+    ---
+    # 权限控制 (RBAC)
+    apiVersion: rbac.authorization.k8s.io/v1
+    kind: Role
+    metadata:
+      namespace: dubbo-system
+      name: pod-reader
+    rules:
+      - apiGroups: [ "" ]
+        resources: [ "pods" ]
+        verbs: [ "get", "list", "watch" ]
+
+    ---
+    # 权限控制 (RBAC)
+    apiVersion: rbac.authorization.k8s.io/v1
+    kind: RoleBinding
+    metadata:
+      name: pod-reader-binding
+      namespace: dubbo-system
+    roleRef:
+      apiGroup: rbac.authorization.k8s.io
+      kind: Role
+      name: pod-reader
+    subjects:
+      - kind: ServiceAccount
+        name: prometheus-k8s
+        namespace: monitoring
+    ```
+
+2.  执行 `kubectl apply -f Deployment.yaml`
+
+3.  打开 Prometheus 的网页界面,例如 `http://localhost:9090/targets`
\ No newline at end of file
diff --git a/metrics/README_zn.md b/metrics/README_zn.md
deleted file mode 100644
index 6df0aaff..00000000
--- a/metrics/README_zn.md
+++ /dev/null
@@ -1,141 +0,0 @@
-# dubbo-go 的度量指标
-
-这个示例演示了如何在 RPC 框架 dubbo-go 
使用度量指标。更详细的说明请参考我们官网的[快速开始](https://cn.dubbo.apache.org/zh-cn/overview/mannual/golang-sdk/quickstart/)
-
-## 目录
-
-- server/main.go - 定义了服务,处理程序和 RPC 服务器的主程序。
-- client/main.go - 是 RPC 客户端。
-- proto - 包含了 API 的 protobuf 定义。
-
-## 如何运行
-
-### 运行服务端
-```shell
-go run ./go-server/cmd/main.go
-```
-
-测试一下服务端是否按照预期工作:
-```shell
-curl \
-    --header "Content-Type: application/json" \
-    --data '{"name": "Dubbo"}' \
-    http://localhost:20000/greet.GreetService/Greet
-```
-
-### 运行客户端
-```shell
-go run ./go-client/cmd/main.go
-```
-
-## 部署到本地
-安装 prometheus 并打开 prometheus 配置文件 `prometheus.yml`,配置如下:
-
-```yaml
-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: ['localhost:9099']
-- job_name: dubbo-consumer
-  scrape_interval: 15s
-  scrape_timeout: 5s
-  metrics_path: /prometheus
-  static_configs:
-    - targets: ['localhost:9097']
-```
-
-安装 grafana 并打开 grafana 的 web 页面,如 `localhost:3000`
-
-打开【Home / Connections / Data sources】
-
-点击【Add new data source】
-
-选择 Prometheus
-
-输入【Prometheus server URL】(比如 `http://localhost:9090`)然后点击【Save & test】
-
-![datasource.png](./assert/datasource.png)
-
-打开【Home / Dashboards】然后点击【New】【import】并输入 19294 点击加载
-
-![import](./assert/import.png)
-
-如果你的 Grafana 无法访问互联网,可以访问 
`https://grafana.com/grafana/dashboards/19294-dubbo-observability/` 并点击 
【Download JSON】
-
-粘贴 JSON
-
-![json.png](./assert/import-json.png)
-
-![datasource.png](./assert/import-datasource.png)
-
-点击【Import】按钮你将看到 Dubbo 可观察性仪表盘,尽情享受吧!
-
-![databoard](./assert/dashboard.png)
-
-## 部署到 Kubernetes
-
-#### kube-prometheus
-
-在 K8s 中安装 prometheus 
[kube-prometheus](https://github.com/prometheus-operator/kube-prometheus)
-
-将 `prometheus-service.yaml` 中的类型设置为 NodePort
-
-1. 将 `dubboPodMoitor.yaml` 添加到 `kube-prometheus` 的 `manifests` 目录下,内容如下:
- ```yaml
-apiVersion: monitoring.coreos.com/v1
-kind: PodMonitor
-metadata:
-  name: podmonitor
-  labels:
-    app: podmonitor
-  namespace: monitoring
-spec:
-  namespaceSelector:
-    matchNames:
-      - dubbo-system
-  selector:
-    matchLabels:
-      app-type: dubbo
-  podMetricsEndpoints:
-    - port: metrics # 引用 dubbo-app 用于暴露指标的端口名
-      path: /prometheus
----
-# rbac
-apiVersion: rbac.authorization.k8s.io/v1
-kind: Role
-metadata:
-  namespace: dubbo-system
-  name: pod-reader
-rules:
-  - apiGroups: [""]
-    resources: ["pods"]
-    verbs: ["get", "list", "watch"]
-
----
-# rbac
-apiVersion: rbac.authorization.k8s.io/v1
-kind: RoleBinding
-metadata:
-  name: pod-reader-binding
-  namespace: dubbo-system
-roleRef:
-  apiGroup: rbac.authorization.k8s.io
-  kind: Role
-  name: pod-reader
-subjects:
-  - kind: ServiceAccount
-    name: prometheus-k8s
-    namespace: monitoring
-```
-
-2. `kubectl apply -f Deployment.yaml`
-
-3. 打开 Prometheus 网页,如 http://localhost:9090/targets
-   ![podmonitor.png](./assert/podmonitor.png)
-
diff --git a/metrics/assert/dashboard.png b/metrics/assert/dashboard.png
deleted file mode 100644
index 4cebf52c..00000000
Binary files a/metrics/assert/dashboard.png and /dev/null differ
diff --git a/metrics/assert/datasource.png b/metrics/assert/datasource.png
deleted file mode 100644
index d19e74b8..00000000
Binary files a/metrics/assert/datasource.png and /dev/null differ
diff --git a/metrics/assert/grafana.png b/metrics/assert/grafana.png
new file mode 100644
index 00000000..e7f43634
Binary files /dev/null and b/metrics/assert/grafana.png differ
diff --git a/metrics/assert/import-datasource.png 
b/metrics/assert/import-datasource.png
deleted file mode 100644
index 333d6b9e..00000000
Binary files a/metrics/assert/import-datasource.png and /dev/null differ
diff --git a/metrics/assert/import-json.png b/metrics/assert/import-json.png
deleted file mode 100644
index 025eb689..00000000
Binary files a/metrics/assert/import-json.png and /dev/null differ
diff --git a/metrics/assert/import.png b/metrics/assert/import.png
deleted file mode 100644
index 41d3913b..00000000
Binary files a/metrics/assert/import.png and /dev/null differ
diff --git a/metrics/assert/podmonitor.png b/metrics/assert/podmonitor.png
deleted file mode 100644
index f1f7ec9a..00000000
Binary files a/metrics/assert/podmonitor.png and /dev/null differ
diff --git a/metrics/docker-compose.yml b/metrics/docker-compose.yml
new file mode 100644
index 00000000..b6be2f0a
--- /dev/null
+++ b/metrics/docker-compose.yml
@@ -0,0 +1,45 @@
+# 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.
+
+services:
+  zookeeper:
+    image: zookeeper
+    container_name: zookeeper
+    restart: unless-stopped
+    ports:
+      - "2181:2181"
+
+  grafana:
+    image: grafana/grafana-enterprise
+    container_name: grafana
+    restart: unless-stopped
+    ports:
+      - "3000:3000"
+
+  prometheus:
+    image: prom/prometheus
+    container_name: prometheus
+    restart: unless-stopped
+    ports:
+      - "9090:9090"
+    volumes:
+      - ./prometheus_pull.yml:/etc/prometheus/prometheus.yml
+
+  pushgateway:
+    image: prom/pushgateway
+    container_name: pushgateway
+    restart: unless-stopped
+    ports:
+      - "9091:9091"
diff --git a/metrics/go-client/cmd/main.go b/metrics/go-client/cmd/main.go
index 799d1318..543a20bc 100644
--- a/metrics/go-client/cmd/main.go
+++ b/metrics/go-client/cmd/main.go
@@ -19,7 +19,6 @@ package main
 
 import (
        "context"
-       "os"
        "time"
 )
 
@@ -37,13 +36,10 @@ import (
 )
 
 func main() {
-       zookeeper := os.Getenv("ZOOKEEPER_ADDRESS")
-       if zookeeper == "" {
-               zookeeper = "localhost"
-       }
        ins, err := dubbo.NewInstance(
                dubbo.WithRegistry(
-                       registry.WithAddress("zookeeper://"+zookeeper+":2181"),
+                       registry.WithZookeeper(),
+                       registry.WithAddress("127.0.0.1:2181"),
                ),
                dubbo.WithMetrics(
                        metrics.WithEnabled(),
diff --git a/metrics/grafana.json b/metrics/grafana.json
new file mode 100644
index 00000000..12a4dca3
--- /dev/null
+++ b/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=~\"$applicatio [...]
+          "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)",
+          "legendFormat": "P99 Latency",
+          "range": true,
+          "refId": "A"
+        }
+      ],
+      "title": "Provider P99 延迟 (Provider P99 Latency)",
+      "type": "stat"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              }
+            ]
+          },
+          "unit": "none"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 5,
+        "w": 5,
+        "x": 19,
+        "y": 1
+      },
+      "id": 1005,
+      "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": 
"avg(dubbo_thread_pool_active_size{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "活跃线程 (Active Threads)",
+          "refId": "A"
+        }
+      ],
+      "title": "平均活跃线程数 (Avg Active Threads)",
+      "type": "stat"
+    },
+    {
+      "collapsed": false,
+      "gridPos": {
+        "h": 1,
+        "w": 24,
+        "x": 0,
+        "y": 6
+      },
+      "id": 2000,
+      "panels": [],
+      "title": "流量与成功率 (Traffic & Success Rate)",
+      "type": "row"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisBorderShow": false,
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "barWidthFactor": 0.6,
+            "drawStyle": "line",
+            "fillOpacity": 10,
+            "gradientMode": "opacity",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "insertNulls": false,
+            "lineInterpolation": "smooth",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "reqps"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 12,
+        "x": 0,
+        "y": 7
+      },
+      "id": 2001,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean",
+            "lastNotNull"
+          ],
+          "displayMode": "table",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "multi",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "sum by (interface) 
(rate(dubbo_provider_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\", 
interface=~\"$provider_interface\"}[$__rate_interval]))",
+          "legendFormat": "P: {{interface}}",
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "sum by (interface) 
(rate(dubbo_consumer_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\", 
interface=~\"$consumer_interface\"}[$__rate_interval]))",
+          "legendFormat": "C: {{interface}}",
+          "refId": "B"
+        }
+      ],
+      "title": "QPS",
+      "type": "timeseries"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisBorderShow": false,
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "成功率 (Success Rate)",
+            "axisPlacement": "right",
+            "barAlignment": 0,
+            "barWidthFactor": 0.6,
+            "drawStyle": "line",
+            "fillOpacity": 5,
+            "gradientMode": "scheme",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "insertNulls": false,
+            "lineInterpolation": "smooth",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "max": 100,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "percent"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 12,
+        "x": 12,
+        "y": 7
+      },
+      "id": 2002,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean",
+            "lastNotNull"
+          ],
+          "displayMode": "table",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "multi",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "(1 - sum by(interface) 
(rate(dubbo_provider_requests_failed_total{application_name=~\"$application_name\",
 instance=~\"$instance\", 
interface=~\"$provider_interface\"}[$__rate_interval])) / sum by(interface) 
(rate(dubbo_provider_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\", 
interface=~\"$provider_interface\"}[$__rate_interval]))) * 100",
+          "legendFormat": "P: {{interface}}",
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "(1 - sum by(interface) 
(rate(dubbo_consumer_requests_failed_total{application_name=~\"$application_name\",
 instance=~\"$instance\", 
interface=~\"$consumer_interface\"}[$__rate_interval])) / sum by(interface) 
(rate(dubbo_consumer_requests_total{application_name=~\"$application_name\", 
instance=~\"$instance\", 
interface=~\"$consumer_interface\"}[$__rate_interval]))) * 100",
+          "legendFormat": "C: {{interface}}",
+          "refId": "B"
+        }
+      ],
+      "title": "请求成功率 (Request Success Rate)",
+      "type": "timeseries"
+    },
+    {
+      "collapsed": false,
+      "gridPos": {
+        "h": 1,
+        "w": 24,
+        "x": 0,
+        "y": 15
+      },
+      "id": 3000,
+      "panels": [],
+      "title": "延迟分析 (Latency Analysis)",
+      "type": "row"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisBorderShow": false,
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "barWidthFactor": 0.6,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "insertNulls": false,
+            "lineInterpolation": "linear",
+            "lineWidth": 2,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "ms"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 9,
+        "w": 24,
+        "x": 0,
+        "y": 16
+      },
+      "id": 3001,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean",
+            "max",
+            "lastNotNull"
+          ],
+          "displayMode": "table",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "multi",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "max by (interface) 
(dubbo_provider_rt_milliseconds_p99{application_name=~\"$application_name\", 
instance=~\"$instance\", interface=~\"$provider_interface\"})",
+          "legendFormat": "P99 - P: {{interface}}",
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "max by (interface) 
(dubbo_provider_rt_milliseconds{application_name=~\"$application_name\", 
instance=~\"$instance\", interface=~\"$provider_interface\"})",
+          "legendFormat": "Avg - P: {{interface}}",
+          "refId": "B"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "max by (interface) 
(dubbo_consumer_rt_milliseconds_p99{application_name=~\"$application_name\", 
instance=~\"$instance\", interface=~\"$consumer_interface\"})",
+          "legendFormat": "P99 - C: {{interface}}",
+          "refId": "C"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "max by (interface) 
(dubbo_consumer_rt_milliseconds{application_name=~\"$application_name\", 
instance=~\"$instance\", interface=~\"$consumer_interface\"})",
+          "legendFormat": "Avg - C: {{interface}}",
+          "refId": "D"
+        }
+      ],
+      "title": "服务延迟 (RT)",
+      "type": "timeseries"
+    },
+    {
+      "collapsed": false,
+      "gridPos": {
+        "h": 1,
+        "w": 24,
+        "x": 0,
+        "y": 25
+      },
+      "id": 4000,
+      "panels": [],
+      "title": "饱和度与资源 (Saturation & Resources)",
+      "type": "row"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisBorderShow": false,
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "barWidthFactor": 0.6,
+            "drawStyle": "line",
+            "fillOpacity": 20,
+            "gradientMode": "opacity",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "insertNulls": false,
+            "lineInterpolation": "smooth",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": 0
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "none"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 9,
+        "w": 14,
+        "x": 0,
+        "y": 26
+      },
+      "id": 4001,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean",
+            "max",
+            "lastNotNull"
+          ],
+          "displayMode": "table",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "multi",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "avg by (thread_pool_name) 
(dubbo_thread_pool_active_size{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "Active - {{thread_pool_name}}",
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "avg by (thread_pool_name) 
(dubbo_thread_pool_thread_count{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "Total - {{thread_pool_name}}",
+          "refId": "B"
+        }
+      ],
+      "title": "线程池状态 (Thread Pool Status)",
+      "type": "timeseries"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            }
+          },
+          "mappings": []
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 9,
+        "w": 5,
+        "x": 14,
+        "y": 26
+      },
+      "id": 4002,
+      "options": {
+        "displayLabels": [
+          "percent",
+          "name"
+        ],
+        "legend": {
+          "displayMode": "list",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "pieType": "pie",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "single",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "count by (instance) 
(dubbo_application_info_total{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "{{instance}}",
+          "refId": "A"
+        }
+      ],
+      "title": "实例分布 (Instance Distribution)",
+      "type": "piechart"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${datasource}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            }
+          },
+          "mappings": []
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 9,
+        "w": 5,
+        "x": 19,
+        "y": 26
+      },
+      "id": 4003,
+      "options": {
+        "displayLabels": [
+          "percent",
+          "name"
+        ],
+        "legend": {
+          "displayMode": "list",
+          "placement": "bottom",
+          "showLegend": true
+        },
+        "pieType": "donut",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "tooltip": {
+          "hideZeros": false,
+          "mode": "single",
+          "sort": "none"
+        }
+      },
+      "pluginVersion": "12.2.0-16791878397",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${datasource}"
+          },
+          "expr": "count by (application_version) 
(dubbo_application_info_total{application_name=~\"$application_name\", 
instance=~\"$instance\"})",
+          "legendFormat": "{{application_version}}",
+          "refId": "A"
+        }
+      ],
+      "title": "版本分布 (Version Distribution)",
+      "type": "piechart"
+    }
+  ],
+  "preload": false,
+  "refresh": "30s",
+  "schemaVersion": 41,
+  "tags": [],
+  "templating": {
+    "list": [
+      {
+        "current": {
+          "text": "prometheus",
+          "value": "deud2hwrpsi68b"
+        },
+        "includeAll": false,
+        "label": "数据源 (Data Source)",
+        "name": "datasource",
+        "options": [],
+        "query": "prometheus",
+        "refresh": 1,
+        "regex": "",
+        "type": "datasource"
+      },
+      {
+        "allValue": ".*",
+        "current": {
+          "text": "All",
+          "value": [
+            "$__all"
+          ]
+        },
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${datasource}"
+        },
+        "definition": "label_values(dubbo_application_info_total, 
application_name)",
+        "includeAll": true,
+        "label": "应用名 (Application Name)",
+        "multi": true,
+        "name": "application_name",
+        "options": [],
+        "query": {
+          "query": "label_values(dubbo_application_info_total, 
application_name)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "type": "query"
+      },
+      {
+        "allValue": ".*",
+        "current": {
+          "text": "All",
+          "value": [
+            "$__all"
+          ]
+        },
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${datasource}"
+        },
+        "definition": 
"label_values(dubbo_application_info_total{application_name=~\"$application_name\"},
 instance)",
+        "includeAll": true,
+        "label": "实例 (Instance)",
+        "multi": true,
+        "name": "instance",
+        "options": [],
+        "query": {
+          "query": 
"label_values(dubbo_application_info_total{application_name=~\"$application_name\"},
 instance)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "type": "query"
+      },
+      {
+        "allValue": ".*",
+        "current": {
+          "text": "All",
+          "value": [
+            "$__all"
+          ]
+        },
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${datasource}"
+        },
+        "definition": 
"label_values(dubbo_provider_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}, interface)",
+        "includeAll": true,
+        "label": "提供者接口 (Provider Interface)",
+        "multi": true,
+        "name": "provider_interface",
+        "options": [],
+        "query": {
+          "query": 
"label_values(dubbo_provider_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}, interface)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "type": "query"
+      },
+      {
+        "allValue": ".*",
+        "current": {
+          "text": "All",
+          "value": [
+            "$__all"
+          ]
+        },
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${datasource}"
+        },
+        "definition": 
"label_values(dubbo_consumer_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}, interface)",
+        "includeAll": true,
+        "label": "消费者接口 (Consumer Interface)",
+        "multi": true,
+        "name": "consumer_interface",
+        "options": [],
+        "query": {
+          "query": 
"label_values(dubbo_consumer_requests_total{application_name=~\"$application_name\",
 instance=~\"$instance\"}, interface)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "type": "query"
+      }
+    ]
+  },
+  "time": {
+    "from": "now-30m",
+    "to": "now"
+  },
+  "timepicker": {},
+  "timezone": "browser",
+  "title": "Dubbo-go Observability",
+  "uid": "57be2306-5cef-4273-9311-ae905ea4cdec",
+  "version": 1
+}
\ No newline at end of file
diff --git a/metrics/prometheus_pull.yml b/metrics/prometheus_pull.yml
new file mode 100644
index 00000000..d2319179
--- /dev/null
+++ b/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:
+      - targets: ['host.docker.internal:9097']
\ No newline at end of file
diff --git a/metrics/prometheus_push.yml b/metrics/prometheus_push.yml
new file mode 100644
index 00000000..e6104950
--- /dev/null
+++ b/metrics/prometheus_push.yml
@@ -0,0 +1,23 @@
+# 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: 'pushgateway'
+    static_configs:
+      - targets: [ 'host.docker.internal:9091' ] # Replace with your 
Pushgateway's actual IP/hostname
+    honor_labels: true

Reply via email to