This is an automated email from the ASF dual-hosted git repository.
dmwangnima pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/main by this push:
new a62e5a68c fix: client metrics and tracing can't enable (#2587)
a62e5a68c is described below
commit a62e5a68c73d972cb5f830d3114b8f1d2e28eac6
Author: wangguan <[email protected]>
AuthorDate: Wed Jan 31 16:22:54 2024 +0800
fix: client metrics and tracing can't enable (#2587)
---
client/client.go | 2 ++
client/options.go | 20 ++++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/client/client.go b/client/client.go
index 4a9a72269..98ab66733 100644
--- a/client/client.go
+++ b/client/client.go
@@ -109,6 +109,8 @@ func (cli *Client) dial(interfaceName string, info
*ClientInfo, opts ...Referenc
setApplicationCompat(cli.cliOpts.applicationCompat),
setRegistriesCompat(cli.cliOpts.registriesCompat),
setConsumer(cli.cliOpts.Consumer),
+ setMetrics(cli.cliOpts.Metrics),
+ setOtel(cli.cliOpts.Otel),
// this config must be set after Reference initialized
setInterfaceName(interfaceName),
}
diff --git a/client/options.go b/client/options.go
index c301eeb6d..3536fc9d2 100644
--- a/client/options.go
+++ b/client/options.go
@@ -429,6 +429,18 @@ func setConsumer(consumer *global.ConsumerConfig)
ReferenceOption {
}
}
+func setMetrics(mc *global.MetricsConfig) ReferenceOption {
+ return func(opts *ReferenceOptions) {
+ opts.Metrics = mc
+ }
+}
+
+func setOtel(oc *global.OtelConfig) ReferenceOption {
+ return func(opts *ReferenceOptions) {
+ opts.Otel = oc
+ }
+}
+
type ClientOptions struct {
Consumer *global.ConsumerConfig
Application *global.ApplicationConfig
@@ -703,11 +715,11 @@ func WithClientProvidedBy(providedBy string) ClientOption
{
}
// todo(DMwangnima): implement this functionality
-//func WithAsync() ClientOption {
+// func WithAsync() ClientOption {
// return func(opts *ClientOptions) {
// opts.Consumer.Async = true
// }
-//}
+// }
func WithClientParams(params map[string]string) ClientOption {
return func(opts *ClientOptions) {
@@ -728,7 +740,7 @@ func WithClientParam(k, v string) ClientOption {
}
// todo(DMwangnima): implement this functionality
-//func WithClientGeneric(generic bool) ClientOption {
+// func WithClientGeneric(generic bool) ClientOption {
// return func(opts *ClientOptions) {
// if generic {
// opts.Consumer.Generic = "true"
@@ -736,7 +748,7 @@ func WithClientParam(k, v string) ClientOption {
// opts.Consumer.Generic = "false"
// }
// }
-//}
+// }
func WithClientSticky() ClientOption {
return func(opts *ClientOptions) {