Open LanceAdd opened 1 month ago
Why is the nacos sdk referenced differently in "github.com/gogf/gf/contrib/config/nacos/v2" and "github.com/gogf/gf/contrib/registry/nacos/v2"
github.com/gogf/gf/contrib/registry/nacos/v2
github.com/joy999/nacos-sdk-go
github.com/gogf/gf/contrib/config/nacos/v2
github.com/nacos-group/nacos-sdk-go/v2
This leads to duplicate registrations when obtaining remote configuration files and registering services
Have you solved this problem?
Have you solved this problem?
I used github.com/nacos-group/nacos-sdk-go/v2
instead of github.com/joy999/nacos-sdk-go
, and then combined it with the content of github.com/gogf/gf/contrib/registry/nacos/v2
to write my own library https://github.com/LanceAdd/nacos-gf
I hope it can help you
Have you solved this problem?
I used
github.com/nacos-group/nacos-sdk-go/v2
instead ofgithub.com/joy999/nacos-sdk-go
, and then combined it with the content ofgithub.com/gogf/gf/contrib/registry/nacos/v2
to write my own libraryhttps://github.com/LanceAdd/nacos-gf
I hope it can help you
Thanks
Same problem
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Same problem
Same problem
The reason for this problem is that nacos-sdk-go is used in config
and registry
, github.com/nacos-group/nacos-sdk-go/v2
is used in config, but github.com/joy999/nacos-sdk-go
is used in registry, which causes multiple initializations of monitor.
If you need to, you can use this https://github.com/LanceAdd/nacos-gf
temporarily
Go version
go version go1.22.4 darwin/amd64
GoFrame version
2.7.2
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
goroutine 1 [running]: github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc0000b9db0, {0xc0004a0300, 0x2, 0x2}) /Users/shanyujie/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:403 +0x116 github.com/prometheus/client_golang/prometheus.MustRegister({0xc0004a0300, 0x2, 0x2}) /Users/shanyujie/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:178 +0x3f github.com/nacos-group/nacos-sdk-go/v2/common/monitor.init.0() /Users/shanyujie/go/pkg/mod/github.com/nacos-group/nacos-sdk-go/v2@v2.2.5/common/monitor/monitor.go:34 +0xc5 Exiting.
server: address: "0.0.0.0:50001" openapiPath: "/api.json" swaggerPath: "/doc.html" accessLogEnabled: true errorLogEnabled: true pprofEnabled: false logPath: "./log" dumpRouterMap: true
panic: duplicate metrics collector registration attempted
goroutine 1 [running]: github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc0000b9db0, {0xc0004a0300, 0x2, 0x2}) /Users/shanyujie/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:403 +0x116 github.com/prometheus/client_golang/prometheus.MustRegister({0xc0004a0300, 0x2, 0x2}) /Users/shanyujie/go/pkg/mod/github.com/prometheus/client_golang@v1.12.2/prometheus/registry.go:178 +0x3f github.com/nacos-group/nacos-sdk-go/v2/common/monitor.init.0() /Users/shanyujie/go/pkg/mod/github.com/nacos-group/nacos-sdk-go/v2@v2.2.5/common/monitor/monitor.go:34 +0xc5 Exiting.