You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Oxidaner (via GitHub)" <gi...@apache.org> on 2026/03/23 03:41:08 UTC
[PR] Feat/graceful shutdown sample [dubbo-go-samples]
Oxidaner opened a new pull request, #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058
a sample for graceful shutdown
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Oxidaner (via GitHub)" <gi...@apache.org>.
Oxidaner commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r3022257066
##########
graceful_shutdown/proto/greet.pb.go:
##########
@@ -0,0 +1,193 @@
+//
+// 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.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.6
+// protoc v6.31.1
+// source: greet.proto
+
+package greet
+
+import (
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type GreetRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GreetRequest) Reset() {
+ *x = GreetRequest{}
+ mi := &file_greet_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GreetRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetRequest) ProtoMessage() {}
+
+func (x *GreetRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_greet_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.
+func (*GreetRequest) Descriptor() ([]byte, []int) {
+ return file_greet_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *GreetRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GreetResponse) Reset() {
+ *x = GreetResponse{}
+ mi := &file_greet_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GreetResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetResponse) ProtoMessage() {}
+
+func (x *GreetResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_greet_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.
+func (*GreetResponse) Descriptor() ([]byte, []int) {
+ return file_greet_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GreetResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+var File_greet_proto protoreflect.FileDescriptor
+
+const file_greet_proto_rawDesc = "" +
+ "\n" +
+ "\vgreet.proto\x12\x05greet\"\"\n" +
+ "\fGreetRequest\x12\x12\n" +
+ "\x04name\x18\x01 \x01(\tR\x04name\"+\n" +
+ "\rGreetResponse\x12\x1a\n" +
+ "\bgreeting\x18\x01 \x01(\tR\bgreeting2D\n" +
+ "\fGreetService\x124\n" +
+ "\x05Greet\x12\x13.greet.GreetRequest\x1a\x14.greet.GreetResponse\"\x00B;Z9github.com/apache/dubbo-go-samples/helloworld/proto;greetb\x06proto3"
Review Comment:
done
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2986304834
##########
graceful_shutdown/go.mod:
##########
Review Comment:
不要提交新的go.mod
使用全局go.mod
##########
graceful_shutdown/README.md:
##########
Review Comment:
pls, refer to other samples, provide README_CN.md
##########
graceful_shutdown/go-client/cmd/main.go:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ "sync/atomic"
+ "time"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+
+ "github.com/dubbogo/gost/log/logger"
+)
+
+import (
+ greet "github.com/apache/dubbo-go-samples/graceful_shutdown/proto"
+)
+
+func main() {
+ addr := flag.String("addr", "tri://127.0.0.1:20000", "server address")
+ interval := flag.Duration("interval", 200*time.Millisecond, "interval between requests for each worker")
+ shortConn := flag.Bool("short", false, "use short connection (create new client for each request)")
+ concurrency := flag.Int("concurrency", 1, "number of concurrent request loops")
+ requestTimeout := flag.Duration("request-timeout", 5*time.Second, "per-request timeout")
+ namePrefix := flag.String("name-prefix", "hello", "request name prefix")
+ flag.Parse()
+
+ logger.Infof("Starting client, addr=%s short=%v concurrency=%d interval=%s request-timeout=%s",
+ *addr, *shortConn, *concurrency, interval.String(), requestTimeout.String())
+
+ var counter atomic.Int64
+ for workerID := 1; workerID <= *concurrency; workerID++ {
+ go runWorker(workerID, *addr, *interval, *shortConn, *requestTimeout, *namePrefix, &counter)
+ }
+
+ select {}
+}
+
+func runWorker(workerID int, addr string, interval time.Duration, shortConn bool, requestTimeout time.Duration, namePrefix string, counter *atomic.Int64) {
+ var svc greet.GreetService
+ var err error
+
+ if !shortConn {
+ _, svc, err = newGreetClient(addr)
+ if err != nil {
+ logger.Errorf("Worker %d failed to create long connection client: %v", workerID, err)
Review Comment:
遇到问题panic出来,以使集成测试失败
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2985392517
##########
graceful_shutdown/go.mod:
##########
@@ -0,0 +1,149 @@
+module github.com/apache/dubbo-go-samples/graceful_shutdown
+
+go 1.25.0
+
+require (
+ dubbo.apache.org/dubbo-go/v3 v3.3.1
+ github.com/dubbogo/gost v1.14.3
+ google.golang.org/protobuf v1.34.1
+)
+
+require (
+ github.com/RoaringBitmap/roaring v1.2.3 // indirect
+ github.com/Workiva/go-datastructures v1.0.52 // indirect
+ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
+ github.com/alibaba/sentinel-golang v1.0.4 // indirect
+ github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
+ github.com/alibabacloud-go/tea v1.1.17 // indirect
+ github.com/alibabacloud-go/tea-utils v1.4.4 // indirect
+ github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 // indirect
+ github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect
+ github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect
+ github.com/apache/dubbo-getty v1.4.10 // indirect
+ github.com/apache/dubbo-go-hessian2 v1.12.5 // indirect
+ github.com/apolloconfig/agollo/v4 v4.4.0 // indirect
+ github.com/beorn7/perks v1.0.1 // indirect
+ github.com/bits-and-blooms/bitset v1.2.0 // indirect
+ github.com/buger/jsonparser v1.1.1 // indirect
+ github.com/cenkalti/backoff/v4 v4.2.1 // indirect
+ github.com/cespare/xxhash/v2 v2.2.0 // indirect
+ github.com/coreos/go-semver v0.3.0 // indirect
+ github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+ github.com/creasty/defaults v1.5.2 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/dlclark/regexp2 v1.7.0 // indirect
+ github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 // indirect
+ github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
+ github.com/dubbogo/grpc-go v1.42.10 // indirect
+ github.com/dubbogo/triple v1.2.2-rc4 // indirect
+ github.com/dustin/go-humanize v1.0.1 // indirect
+ github.com/emicklei/go-restful/v3 v3.10.1 // indirect
+ github.com/fsnotify/fsnotify v1.6.0 // indirect
+ github.com/go-logr/logr v1.3.0 // indirect
+ github.com/go-logr/stdr v1.2.2 // indirect
+ github.com/go-ole/go-ole v1.2.6 // indirect
+ github.com/go-playground/locales v0.14.1 // indirect
+ github.com/go-playground/universal-translator v0.18.1 // indirect
+ github.com/go-playground/validator/v10 v10.12.0 // indirect
+ github.com/go-resty/resty/v2 v2.7.0 // indirect
+ github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
+ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
+ github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang/mock v1.6.0 // indirect
+ github.com/golang/protobuf v1.5.4 // indirect
+ github.com/golang/snappy v0.0.4 // indirect
+ github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
+ github.com/google/uuid v1.6.0 // indirect
+ github.com/gorilla/websocket v1.4.2 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
+ github.com/hashicorp/errwrap v1.1.0 // indirect
+ github.com/hashicorp/go-multierror v1.1.1 // indirect
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/hashicorp/vault/sdk v0.7.0 // indirect
+ github.com/influxdata/tdigest v0.0.1 // indirect
+ github.com/jmespath/go-jmespath v0.4.0 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/k0kubun/pp v3.0.1+incompatible // indirect
+ github.com/knadh/koanf v1.5.0 // indirect
+ github.com/leodido/go-urn v1.2.2 // indirect
+ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
+ github.com/magiconair/properties v1.8.5 // indirect
+ github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mattn/go-isatty v0.0.16 // indirect
+ github.com/mitchellh/copystructure v1.2.0 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/mitchellh/mapstructure v1.5.0 // indirect
+ github.com/mitchellh/reflectwalk v1.0.2 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
+ github.com/mschoch/smat v0.2.0 // indirect
+ github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 // indirect
+ github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
+ github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
+ github.com/onsi/ginkgo/v2 v2.11.0 // indirect
+ github.com/opentracing/opentracing-go v1.2.0 // indirect
+ github.com/openzipkin/zipkin-go v0.4.2 // indirect
+ github.com/pelletier/go-toml v1.9.3 // indirect
+ github.com/pierrec/lz4 v2.6.1+incompatible // indirect
+ github.com/pkg/errors v0.9.1 // indirect
+ github.com/polarismesh/polaris-go v1.3.0 // indirect
+ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
+ github.com/prometheus/client_golang v1.19.1 // indirect
+ github.com/prometheus/client_model v0.5.0 // indirect
+ github.com/prometheus/common v0.48.0 // indirect
+ github.com/prometheus/procfs v0.12.0 // indirect
+ github.com/quic-go/qpack v0.5.1 // indirect
+ github.com/quic-go/quic-go v0.52.0 // indirect
+ github.com/shirou/gopsutil/v3 v3.22.2 // indirect
+ github.com/sirupsen/logrus v1.9.4 // indirect
+ github.com/spaolacci/murmur3 v1.1.0 // indirect
+ github.com/spf13/afero v1.6.0 // indirect
+ github.com/spf13/cast v1.3.1 // indirect
+ github.com/spf13/jwalterweatherman v1.1.0 // indirect
+ github.com/spf13/pflag v1.0.5 // indirect
+ github.com/spf13/viper v1.8.1 // indirect
+ github.com/subosito/gotenv v1.2.0 // indirect
+ github.com/tklauser/go-sysconf v0.3.10 // indirect
+ github.com/tklauser/numcpus v0.4.0 // indirect
+ github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
+ github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
+ github.com/ugorji/go/codec v1.2.6 // indirect
+ github.com/yusufpapurcu/wmi v1.2.2 // indirect
+ go.etcd.io/etcd/api/v3 v3.5.7 // indirect
+ go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
+ go.etcd.io/etcd/client/v3 v3.5.7 // indirect
+ go.opentelemetry.io/contrib/propagators/b3 v1.10.0 // indirect
+ go.opentelemetry.io/otel v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect
+ go.opentelemetry.io/otel/metric v1.21.0 // indirect
+ go.opentelemetry.io/otel/sdk v1.21.0 // indirect
+ go.opentelemetry.io/otel/trace v1.21.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.0.0 // indirect
+ go.uber.org/atomic v1.10.0 // indirect
+ go.uber.org/mock v0.5.0 // indirect
+ go.uber.org/multierr v1.8.0 // indirect
+ go.uber.org/zap v1.21.0 // indirect
+ golang.org/x/crypto v0.49.0 // indirect
+ golang.org/x/mod v0.34.0 // indirect
+ golang.org/x/net v0.52.0 // indirect
+ golang.org/x/sync v0.20.0 // indirect
+ golang.org/x/sys v0.42.0 // indirect
+ golang.org/x/text v0.35.0 // indirect
+ golang.org/x/time v0.15.0 // indirect
+ golang.org/x/tools v0.43.0 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
+ google.golang.org/grpc v1.64.0 // indirect
+ gopkg.in/ini.v1 v1.66.2 // indirect
+ gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
+ gopkg.in/yaml.v2 v2.4.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+
+replace dubbo.apache.org/dubbo-go/v3 => E:/project/go_project/dubbo/dubbo-go
Review Comment:
这里把 `dubbo-go` 的 `replace` 写死成了作者本机的 `E:/...` 路径,我本地直接跑 `go test ./...` 就会因为这个路径不存在而失败。示例仓库一旦提交这种绝对路径,其他开发者和 CI 都没法直接构建。建议不要把本地 `replace` 提交进仓库,改成 README 里说明用户需要按自己的环境临时添加,或者换成仓库内可复用的相对路径方案。
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Oxidaner (via GitHub)" <gi...@apache.org>.
Oxidaner commented on PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#issuecomment-4147293854
我还没加集成测试 还会有一个 pr
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2992030401
##########
graceful_shutdown/go.mod:
##########
@@ -0,0 +1,148 @@
+module github.com/apache/dubbo-go-samples/graceful_shutdown
+
+go 1.25.0
+
+require (
Review Comment:
上游还没合并,这里出现这种情况是符合预期的
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl merged PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Oxidaner (via GitHub)" <gi...@apache.org>.
Oxidaner commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2985406596
##########
graceful_shutdown/go.mod:
##########
@@ -0,0 +1,149 @@
+module github.com/apache/dubbo-go-samples/graceful_shutdown
+
+go 1.25.0
+
+require (
+ dubbo.apache.org/dubbo-go/v3 v3.3.1
+ github.com/dubbogo/gost v1.14.3
+ google.golang.org/protobuf v1.34.1
+)
+
+require (
+ github.com/RoaringBitmap/roaring v1.2.3 // indirect
+ github.com/Workiva/go-datastructures v1.0.52 // indirect
+ github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
+ github.com/alibaba/sentinel-golang v1.0.4 // indirect
+ github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
+ github.com/alibabacloud-go/tea v1.1.17 // indirect
+ github.com/alibabacloud-go/tea-utils v1.4.4 // indirect
+ github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 // indirect
+ github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect
+ github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect
+ github.com/apache/dubbo-getty v1.4.10 // indirect
+ github.com/apache/dubbo-go-hessian2 v1.12.5 // indirect
+ github.com/apolloconfig/agollo/v4 v4.4.0 // indirect
+ github.com/beorn7/perks v1.0.1 // indirect
+ github.com/bits-and-blooms/bitset v1.2.0 // indirect
+ github.com/buger/jsonparser v1.1.1 // indirect
+ github.com/cenkalti/backoff/v4 v4.2.1 // indirect
+ github.com/cespare/xxhash/v2 v2.2.0 // indirect
+ github.com/coreos/go-semver v0.3.0 // indirect
+ github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+ github.com/creasty/defaults v1.5.2 // indirect
+ github.com/davecgh/go-spew v1.1.1 // indirect
+ github.com/dlclark/regexp2 v1.7.0 // indirect
+ github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 // indirect
+ github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
+ github.com/dubbogo/grpc-go v1.42.10 // indirect
+ github.com/dubbogo/triple v1.2.2-rc4 // indirect
+ github.com/dustin/go-humanize v1.0.1 // indirect
+ github.com/emicklei/go-restful/v3 v3.10.1 // indirect
+ github.com/fsnotify/fsnotify v1.6.0 // indirect
+ github.com/go-logr/logr v1.3.0 // indirect
+ github.com/go-logr/stdr v1.2.2 // indirect
+ github.com/go-ole/go-ole v1.2.6 // indirect
+ github.com/go-playground/locales v0.14.1 // indirect
+ github.com/go-playground/universal-translator v0.18.1 // indirect
+ github.com/go-playground/validator/v10 v10.12.0 // indirect
+ github.com/go-resty/resty/v2 v2.7.0 // indirect
+ github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
+ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
+ github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang/mock v1.6.0 // indirect
+ github.com/golang/protobuf v1.5.4 // indirect
+ github.com/golang/snappy v0.0.4 // indirect
+ github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
+ github.com/google/uuid v1.6.0 // indirect
+ github.com/gorilla/websocket v1.4.2 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
+ github.com/hashicorp/errwrap v1.1.0 // indirect
+ github.com/hashicorp/go-multierror v1.1.1 // indirect
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/hashicorp/vault/sdk v0.7.0 // indirect
+ github.com/influxdata/tdigest v0.0.1 // indirect
+ github.com/jmespath/go-jmespath v0.4.0 // indirect
+ github.com/json-iterator/go v1.1.12 // indirect
+ github.com/k0kubun/pp v3.0.1+incompatible // indirect
+ github.com/knadh/koanf v1.5.0 // indirect
+ github.com/leodido/go-urn v1.2.2 // indirect
+ github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
+ github.com/magiconair/properties v1.8.5 // indirect
+ github.com/mattn/go-colorable v0.1.13 // indirect
+ github.com/mattn/go-isatty v0.0.16 // indirect
+ github.com/mitchellh/copystructure v1.2.0 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/mitchellh/mapstructure v1.5.0 // indirect
+ github.com/mitchellh/reflectwalk v1.0.2 // indirect
+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
+ github.com/modern-go/reflect2 v1.0.2 // indirect
+ github.com/mschoch/smat v0.2.0 // indirect
+ github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 // indirect
+ github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
+ github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
+ github.com/onsi/ginkgo/v2 v2.11.0 // indirect
+ github.com/opentracing/opentracing-go v1.2.0 // indirect
+ github.com/openzipkin/zipkin-go v0.4.2 // indirect
+ github.com/pelletier/go-toml v1.9.3 // indirect
+ github.com/pierrec/lz4 v2.6.1+incompatible // indirect
+ github.com/pkg/errors v0.9.1 // indirect
+ github.com/polarismesh/polaris-go v1.3.0 // indirect
+ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
+ github.com/prometheus/client_golang v1.19.1 // indirect
+ github.com/prometheus/client_model v0.5.0 // indirect
+ github.com/prometheus/common v0.48.0 // indirect
+ github.com/prometheus/procfs v0.12.0 // indirect
+ github.com/quic-go/qpack v0.5.1 // indirect
+ github.com/quic-go/quic-go v0.52.0 // indirect
+ github.com/shirou/gopsutil/v3 v3.22.2 // indirect
+ github.com/sirupsen/logrus v1.9.4 // indirect
+ github.com/spaolacci/murmur3 v1.1.0 // indirect
+ github.com/spf13/afero v1.6.0 // indirect
+ github.com/spf13/cast v1.3.1 // indirect
+ github.com/spf13/jwalterweatherman v1.1.0 // indirect
+ github.com/spf13/pflag v1.0.5 // indirect
+ github.com/spf13/viper v1.8.1 // indirect
+ github.com/subosito/gotenv v1.2.0 // indirect
+ github.com/tklauser/go-sysconf v0.3.10 // indirect
+ github.com/tklauser/numcpus v0.4.0 // indirect
+ github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
+ github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
+ github.com/ugorji/go/codec v1.2.6 // indirect
+ github.com/yusufpapurcu/wmi v1.2.2 // indirect
+ go.etcd.io/etcd/api/v3 v3.5.7 // indirect
+ go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
+ go.etcd.io/etcd/client/v3 v3.5.7 // indirect
+ go.opentelemetry.io/contrib/propagators/b3 v1.10.0 // indirect
+ go.opentelemetry.io/otel v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.21.0 // indirect
+ go.opentelemetry.io/otel/exporters/zipkin v1.21.0 // indirect
+ go.opentelemetry.io/otel/metric v1.21.0 // indirect
+ go.opentelemetry.io/otel/sdk v1.21.0 // indirect
+ go.opentelemetry.io/otel/trace v1.21.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.0.0 // indirect
+ go.uber.org/atomic v1.10.0 // indirect
+ go.uber.org/mock v0.5.0 // indirect
+ go.uber.org/multierr v1.8.0 // indirect
+ go.uber.org/zap v1.21.0 // indirect
+ golang.org/x/crypto v0.49.0 // indirect
+ golang.org/x/mod v0.34.0 // indirect
+ golang.org/x/net v0.52.0 // indirect
+ golang.org/x/sync v0.20.0 // indirect
+ golang.org/x/sys v0.42.0 // indirect
+ golang.org/x/text v0.35.0 // indirect
+ golang.org/x/time v0.15.0 // indirect
+ golang.org/x/tools v0.43.0 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
+ google.golang.org/grpc v1.64.0 // indirect
+ gopkg.in/ini.v1 v1.66.2 // indirect
+ gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
+ gopkg.in/yaml.v2 v2.4.0 // indirect
+ gopkg.in/yaml.v3 v3.0.1 // indirect
+)
+
+replace dubbo.apache.org/dubbo-go/v3 => E:/project/go_project/dubbo/dubbo-go
Review Comment:
抱歉, 忘记更改
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#issuecomment-4151730938
upstream pr have been merged, this sample should be able to run successfully, pls fix my comments
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "Oxidaner (via GitHub)" <gi...@apache.org>.
Oxidaner commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r3016528177
##########
graceful_shutdown/go.mod:
##########
Review Comment:
done
##########
graceful_shutdown/README.md:
##########
Review Comment:
done
##########
graceful_shutdown/go-client/cmd/main.go:
##########
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ "sync/atomic"
+ "time"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+
+ "github.com/dubbogo/gost/log/logger"
+)
+
+import (
+ greet "github.com/apache/dubbo-go-samples/graceful_shutdown/proto"
+)
+
+func main() {
+ addr := flag.String("addr", "tri://127.0.0.1:20000", "server address")
+ interval := flag.Duration("interval", 200*time.Millisecond, "interval between requests for each worker")
+ shortConn := flag.Bool("short", false, "use short connection (create new client for each request)")
+ concurrency := flag.Int("concurrency", 1, "number of concurrent request loops")
+ requestTimeout := flag.Duration("request-timeout", 5*time.Second, "per-request timeout")
+ namePrefix := flag.String("name-prefix", "hello", "request name prefix")
+ flag.Parse()
+
+ logger.Infof("Starting client, addr=%s short=%v concurrency=%d interval=%s request-timeout=%s",
+ *addr, *shortConn, *concurrency, interval.String(), requestTimeout.String())
+
+ var counter atomic.Int64
+ for workerID := 1; workerID <= *concurrency; workerID++ {
+ go runWorker(workerID, *addr, *interval, *shortConn, *requestTimeout, *namePrefix, &counter)
+ }
+
+ select {}
+}
+
+func runWorker(workerID int, addr string, interval time.Duration, shortConn bool, requestTimeout time.Duration, namePrefix string, counter *atomic.Int64) {
+ var svc greet.GreetService
+ var err error
+
+ if !shortConn {
+ _, svc, err = newGreetClient(addr)
+ if err != nil {
+ logger.Errorf("Worker %d failed to create long connection client: %v", workerID, err)
Review Comment:
done
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2990518185
##########
graceful_shutdown/proto/greet.pb.go:
##########
@@ -0,0 +1,193 @@
+//
+// 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.
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.6
+// protoc v6.31.1
+// source: greet.proto
+
+package greet
+
+import (
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type GreetRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GreetRequest) Reset() {
+ *x = GreetRequest{}
+ mi := &file_greet_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GreetRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetRequest) ProtoMessage() {}
+
+func (x *GreetRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_greet_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetRequest.ProtoReflect.Descriptor instead.
+func (*GreetRequest) Descriptor() ([]byte, []int) {
+ return file_greet_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *GreetRequest) GetName() string {
+ if x != nil {
+ return x.Name
+ }
+ return ""
+}
+
+type GreetResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Greeting string `protobuf:"bytes,1,opt,name=greeting,proto3" json:"greeting,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *GreetResponse) Reset() {
+ *x = GreetResponse{}
+ mi := &file_greet_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *GreetResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GreetResponse) ProtoMessage() {}
+
+func (x *GreetResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_greet_proto_msgTypes[1]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GreetResponse.ProtoReflect.Descriptor instead.
+func (*GreetResponse) Descriptor() ([]byte, []int) {
+ return file_greet_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *GreetResponse) GetGreeting() string {
+ if x != nil {
+ return x.Greeting
+ }
+ return ""
+}
+
+var File_greet_proto protoreflect.FileDescriptor
+
+const file_greet_proto_rawDesc = "" +
+ "\n" +
+ "\vgreet.proto\x12\x05greet\"\"\n" +
+ "\fGreetRequest\x12\x12\n" +
+ "\x04name\x18\x01 \x01(\tR\x04name\"+\n" +
+ "\rGreetResponse\x12\x1a\n" +
+ "\bgreeting\x18\x01 \x01(\tR\bgreeting2D\n" +
+ "\fGreetService\x124\n" +
+ "\x05Greet\x12\x13.greet.GreetRequest\x1a\x14.greet.GreetResponse\"\x00B;Z9github.com/apache/dubbo-go-samples/helloworld/proto;greetb\x06proto3"
Review Comment:
[P1] 这里的 raw descriptor 还是 `github.com/apache/dubbo-go-samples/helloworld/proto`,和当前 `greet.proto` 里的 `go_package = github.com/apache/dubbo-go-samples/graceful_shutdown/proto;greet` 不一致,说明 `greet.pb.go` 不是按这次提交的 proto 重新生成的。依赖 `protoreflect.FileDescriptor`、反射或 descriptor 导出的场景会暴露错误包路径。建议用当前 proto 重新生成 `greet.pb.go` 和 `greet.triple.go`。
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Feat/graceful shutdown sample [dubbo-go-samples]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #1058:
URL: https://github.com/apache/dubbo-go-samples/pull/1058#discussion_r2990635824
##########
graceful_shutdown/go.mod:
##########
@@ -0,0 +1,148 @@
+module github.com/apache/dubbo-go-samples/graceful_shutdown
+
+go 1.25.0
+
+require (
Review Comment:
[P1] 这个子模块在干净环境里现在是不能直接编译的。我本地进入 `graceful_shutdown` 后执行 `go test ./...`,会报一串 `missing go.sum entry for module providing package dubbo.apache.org/dubbo-go/v3/...`,说明提交里的 `go.mod/go.sum` 没有 tidy 完整。建议在子模块目录补一次 `go mod tidy`,把 `dubbo-go/v3` 相关依赖的校验条目补齐后再提交。
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org