未验证 提交 37705dfb 编写于 作者: B Bingyi Sun 提交者: GitHub

Add module name to logger in proxy (#13580)

Signed-off-by: Nsunby <bingyi.sun@zilliz.com>
Co-authored-by: Nsunby <bingyi.sun@zilliz.com>
上级 ecd3dc58
......@@ -351,7 +351,8 @@ func (mr *MilvusRoles) Run(localMsg bool, alias string) {
var pn *components.Proxy
if mr.EnableProxy {
pn = mr.runProxy(ctx, localMsg, alias)
pctx := logutil.WithModule(ctx, "Proxy")
pn = mr.runProxy(pctx, localMsg, alias)
if pn != nil {
defer pn.Stop()
}
......
......@@ -24,6 +24,7 @@ import (
"strconv"
"github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/logutil"
"github.com/milvus-io/milvus/internal/util/funcutil"
......@@ -46,6 +47,8 @@ import (
"github.com/milvus-io/milvus/internal/util/typeutil"
)
const moduleName = "Proxy"
// UpdateStateCode updates the state code of Proxy.
func (node *Proxy) UpdateStateCode(code internalpb.StateCode) {
node.stateCode.Store(code)
......@@ -94,7 +97,8 @@ func (node *Proxy) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringRe
// InvalidateCollectionMetaCache invalidate the meta cache of specific collection.
func (node *Proxy) InvalidateCollectionMetaCache(ctx context.Context, request *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error) {
log.Debug("InvalidateCollectionMetaCache",
ctx = logutil.WithModule(ctx, moduleName)
logutil.Logger(ctx).Debug("received request to invalidate collection meta cache",
zap.String("role", typeutil.ProxyRole),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName))
......@@ -103,7 +107,7 @@ func (node *Proxy) InvalidateCollectionMetaCache(ctx context.Context, request *p
if globalMetaCache != nil {
globalMetaCache.RemoveCollection(ctx, collectionName) // no need to return error, though collection may be not cached
}
log.Debug("InvalidateCollectionMetaCache Done",
logutil.Logger(ctx).Debug("complete to invalidate collection meta cache",
zap.String("role", typeutil.ProxyRole),
zap.String("db", request.DbName),
zap.String("collection", request.CollectionName))
......@@ -116,7 +120,8 @@ func (node *Proxy) InvalidateCollectionMetaCache(ctx context.Context, request *p
// ReleaseDQLMessageStream release the query message stream of specific collection.
func (node *Proxy) ReleaseDQLMessageStream(ctx context.Context, request *proxypb.ReleaseDQLMessageStreamRequest) (*commonpb.Status, error) {
log.Debug("ReleaseDQLMessageStream",
ctx = logutil.WithModule(ctx, moduleName)
logutil.Logger(ctx).Debug("received request to release DQL message strem",
zap.Any("role", typeutil.ProxyRole),
zap.Any("db", request.DbID),
zap.Any("collection", request.CollectionID))
......@@ -127,7 +132,7 @@ func (node *Proxy) ReleaseDQLMessageStream(ctx context.Context, request *proxypb
_ = node.chMgr.removeDQLStream(request.CollectionID)
log.Debug("ReleaseDQLMessageStream Done",
logutil.Logger(ctx).Debug("complete to release DQL message stream",
zap.Any("role", typeutil.ProxyRole),
zap.Any("db", request.DbID),
zap.Any("collection", request.CollectionID))
......
......@@ -25,6 +25,7 @@ import (
"syscall"
"time"
"github.com/milvus-io/milvus/internal/logutil"
"github.com/milvus-io/milvus/internal/util/metricsinfo"
"github.com/milvus-io/milvus/internal/metrics"
......@@ -103,7 +104,7 @@ func NewProxy(ctx context.Context, factory msgstream.Factory) (*Proxy, error) {
msFactory: factory,
}
node.UpdateStateCode(internalpb.StateCode_Abnormal)
log.Debug("Proxy", zap.Any("State", node.stateCode.Load()))
logutil.Logger(ctx).Debug("create a new Proxy instance", zap.Any("state", node.stateCode.Load()))
return node, nil
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册