contrueCT opened a new issue, #7852:
URL: https://github.com/apache/incubator-seata/issues/7852

   ### Check Ahead
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of 
this repository and believe that this is not a duplicate.
   
   - [x] I am willing to try to implement this feature myself.
   
   
   ### Why you need it?
   
   目前NamingServer还没有任何metrics,为实现注册中心的状态观测功能,需要为NamingServer增加metrics监控。
   
   ### How it could be?
   
   ## 指标设计方案
   ### 1. 核心业务指标 (Business Metrics)
   
   #### 1.1. 集群节点存活数 (Cluster Node Count)
   
   *   **类型**: `Gauge`
   *   **指标名**: `seata_namingserver_cluster_node_count`
   *   **含义**: 当前注册表中,处于存活状态的 Seata Server 节点数量。
   *   **Tags**:
       *   `namespace`: 命名空间 (e.g., public)
       *   `cluster`: 集群名称 (e.g., sh_cluster)
       *   `unit`: 单元名称 (e.g., unit1)
   *   监控集群规模
   
   #### 1.2. 长轮询挂起连接数 (Long Polling Watcher Count)
   
   *   **类型**: `Gauge`
   *   **指标名**: `seata_namingserver_watcher_count`
   *   **含义**: 当前正在等待变更通知的 HTTP 连接数。
   *   **Tags**:
       *   `vgroup`: 事务分组 (e.g., order_tx_group)
   
   #### 1.3. 集群变更推送次数 (Cluster Change Push Count)
   
   *   **类型**: `Counter`
   *   **指标名**: `seata_namingserver_cluster_change_push_total`
   *   **含义**: NamingServer 向客户端推送变更通知(即唤醒 Watcher)的累计次数。
   *   **Tags**:
       *   `vgroup`: 事务分组
   *   衡量集群的不稳定性。
   
   ---
   
   ### 2. HTTP 流量与性能指标 (Traffic & Latency Metrics)
   
   #### 2.1. HTTP 请求吞吐量 (HTTP Request Throughput)
   
   *   **类型**: `Counter`
   *   **指标名**: `seata_namingserver_http_request_total`
   *   **含义**: 接收到的 HTTP 请求总数。
   *   **Tags**:
       *   `uri`: 接口路径 (e.g., `/naming/v1/register`, `/naming/v1/watch`)
       *   `method`: 请求方法 (POST/GET)
       *   `status`: 响应状态码 (200, 400, 500)
   
   #### 2.2. HTTP 请求响应时间 (HTTP Request Latency)
   
   *   **类型**: `Timer` (Histogram)
   *   **指标名**: `seata_namingserver_http_request_latency`
   *   **含义**: 接口处理耗时的分布情况。
   *   **Tags**:
       *   `uri`: 接口路径
   
   ---
   
   ### 总结:
   
   | 指标名称 (Metric Name)                         | 类型        | 关键 Tags          
| 监控意图       |
   | :--------------------------------------------- | :---------- | 
:----------------- | :------------- |
   | `seata_namingserver_cluster_node_count`        | **Gauge**   | namespace, 
cluster | **存活监控**   |
   | `seata_namingserver_watcher_count`             | **Gauge**   | vgroup      
       | **连接监控**   |
   | `seata_namingserver_http_request_total`        | **Counter** | uri, status 
       | **流量监控**   |
   | `seata_namingserver_http_request_latency`      | **Timer**   | uri         
       | **性能监控**   |
   | `seata_namingserver_cluster_change_push_total` | **Counter** | vgroup      
       | **稳定性监控** |
   
   ### 代码方案
   
   主要使用seata已有的metrics实现埋点监测
   
   其中http接口监控通过一个新的AOP统一处理
   
   引入seata-metrics相关依赖
   
   如有不足请指出,我可以来实现这个功能。
   
   ### Other related information
   
   _No response_


-- 
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