elonzh / clash_exporter

Clash Exporter for Prometheus
GNU General Public License v3.0
8 stars 5 forks source link

部分节点信息client.GetProxyDelay无法识别 #4

Open helianchichi opened 1 month ago

helianchichi commented 1 month ago
root@738d79705084:/clash_exporter# git diff client.go
diff --git a/client.go b/client.go
index fa35324..664c8de 100644
--- a/client.go
+++ b/client.go
@@ -160,8 +160,8 @@ func GetAllProxyDelay(proxies map[string]*Proxy, filter func(*Proxy) bool, clien
                        go func(proxy *Proxy) {
                                defer wg.Done()
                                delay, err := client.GetProxyDelay(proxy.Name, testUrl, testUrlTimeout)
+                               level.Warn(logger).Log("msg", "error when get proxy delay", "err", err, "proxyType", proxy.Type, "proxyName", proxy.Name)
                                if err != nil {
-                                       level.Warn(logger).Log("msg", "error when get proxy delay", "err", err, "proxyType", proxy.Type, "proxyName", proxy.Name)
                                        delay = MaxDelay
                                }
                                ch <- struct {
root@ubuntu:/usr/src/language/go/clash_exporter# ./clash_exporter 
level=warn ts=2024-09-26T03:29:17.055Z caller=client.go:163 msg="error when get proxy delay" err=null proxyType=Shadowsocks proxyName="🇬🇧 英国04|1x" #正常输出
level=warn ts=2024-09-26T03:29:19.179Z caller=client.go:163 msg="error when get proxy delay" err="json: cannot unmarshal string into Go value of type uint16" proxyType=Shadowsocks proxyName=JPA||[特殊地区及海外用户] #错误输出(string不带引号)
elonzh commented 1 month ago

看上去似乎是 clash API 响应不能被正确的处理, 可以提供一下 clash 版本信息和复现配置

helianchichi commented 1 month ago

看上去似乎是 clash API 响应不能被正确的处理, 可以提供一下 clash 版本信息和复现配置