You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ju...@apache.org on 2021/12/01 11:51:49 UTC
[dubbo-go] branch feat-adasvc updated: feat(adasvc): add debug logs
This is an automated email from the ASF dual-hosted git repository.
justxuewei pushed a commit to branch feat-adasvc
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/feat-adasvc by this push:
new 1fa48ca feat(adasvc): add debug logs
1fa48ca is described below
commit 1fa48ca28c13dbba0cff16bf1fed6310412e40b5
Author: XavierNiu <a...@nxw.name>
AuthorDate: Wed Dec 1 19:51:33 2021 +0800
feat(adasvc): add debug logs
---
cluster/cluster/adaptivesvc/cluster_invoker.go | 3 +++
filter/adaptivesvc/filter.go | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/cluster/cluster/adaptivesvc/cluster_invoker.go b/cluster/cluster/adaptivesvc/cluster_invoker.go
index 444f428..fb6c7cd 100644
--- a/cluster/cluster/adaptivesvc/cluster_invoker.go
+++ b/cluster/cluster/adaptivesvc/cluster_invoker.go
@@ -24,6 +24,7 @@ import (
"dubbo.apache.org/dubbo-go/v3/cluster/metrics"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
"dubbo.apache.org/dubbo-go/v3/protocol"
perrors "github.com/pkg/errors"
)
@@ -61,6 +62,8 @@ func (ivk *adaptiveServiceClusterInvoker) Invoke(ctx context.Context, invocation
// update metrics
remaining := invocation.Attachments()[constant.AdaptiveServiceRemainingKey]
+ logger.Debugf("[adasvc cluster] The server status was received successfully, %s: %#v",
+ constant.AdaptiveServiceRemainingKey, remaining)
err := metrics.LocalMetrics.SetMethodMetrics(invoker.GetURL(),
invocation.MethodName(), metrics.HillClimbing, remaining)
if err != nil {
diff --git a/filter/adaptivesvc/filter.go b/filter/adaptivesvc/filter.go
index 6cfed0b..61d543d 100644
--- a/filter/adaptivesvc/filter.go
+++ b/filter/adaptivesvc/filter.go
@@ -21,6 +21,7 @@ import (
"context"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
"dubbo.apache.org/dubbo-go/v3/filter"
"dubbo.apache.org/dubbo-go/v3/filter/adaptivesvc/limiter"
"dubbo.apache.org/dubbo-go/v3/protocol"
@@ -93,7 +94,10 @@ func (f *adaptiveServiceProviderFilter) OnResponse(_ context.Context, result pro
err := updater.DoUpdate()
if err != nil {
- return &protocol.RPCResult{Err: err}
+ // DoUpdate was failed, but the invocation is not failed.
+ // Printing the error to logs is better than returning a
+ // result with an error.
+ logger.Errorf("[adasvc filter] The DoUpdate method was failed, err: %s.", err)
}
// get limiter for the mapper
@@ -105,6 +109,9 @@ func (f *adaptiveServiceProviderFilter) OnResponse(_ context.Context, result pro
// set attachments to inform consumer of provider status
invocation.SetAttachments(constant.AdaptiveServiceRemainingKey, l.Remaining())
invocation.SetAttachments(constant.AdaptiveServiceInflightKey, l.Inflight())
+ logger.Debugf("[adasvc filter] The attachments are set, %s: %d, %s: %d.",
+ constant.AdaptiveServiceRemainingKey, l.Remaining(),
+ constant.AdaptiveServiceInflightKey, l.Inflight())
return result
}