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 99b1ef17 fix: metrics sample start failed (#856)
99b1ef17 is described below

commit 99b1ef171b9f3990464ae4b83e87406279bf4bde
Author: marsevilspirit <[email protected]>
AuthorDate: Sun Aug 3 11:19:38 2025 +0800

    fix: metrics sample start failed (#856)
    
    * fix metrics sample
    
    * fix(ci): glangci-lint error
---
 metrics/go-server/cmd/main.go | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/metrics/go-server/cmd/main.go b/metrics/go-server/cmd/main.go
index 1e7842fd..2db51758 100644
--- a/metrics/go-server/cmd/main.go
+++ b/metrics/go-server/cmd/main.go
@@ -22,7 +22,6 @@ import (
        "dubbo.apache.org/dubbo-go/v3/registry"
        "github.com/pkg/errors"
        "math/rand"
-       "os"
        "time"
 
        "dubbo.apache.org/dubbo-go/v3"
@@ -50,13 +49,10 @@ func (srv *GreetTripleServer) Greet(_ context.Context, req 
*greet.GreetRequest)
 }
 
 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(),                   // default 
false

Reply via email to