mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
enhance: support access log print cluster prefix (#29646)
relate: https://github.com/milvus-io/milvus/issues/29645 Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
parent
1c1f2a1371
commit
70ec00cd5d
@ -49,6 +49,7 @@ var metricFuncMap = map[string]getMetricFunc{
|
||||
"$time_end": getTimeEnd,
|
||||
"$method_expr": getExpr,
|
||||
"$sdk_version": getSdkVersion,
|
||||
"$cluster_prefix": getClusterPrefix,
|
||||
}
|
||||
|
||||
var BaseFormatterKey = "base"
|
||||
|
||||
@ -32,6 +32,7 @@ import (
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus/internal/proxy/connection"
|
||||
"github.com/milvus-io/milvus/pkg/util/merr"
|
||||
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
||||
"github.com/milvus-io/milvus/pkg/util/requestutil"
|
||||
)
|
||||
|
||||
@ -272,3 +273,7 @@ func getSdkVersion(i *GrpcAccessInfo) string {
|
||||
}
|
||||
return clientInfo.SdkType + "-" + clientInfo.SdkVersion
|
||||
}
|
||||
|
||||
func getClusterPrefix(i *GrpcAccessInfo) string {
|
||||
return paramtable.Get().CommonCfg.ClusterPrefix.GetValue()
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@ import (
|
||||
"github.com/milvus-io/milvus/pkg/util"
|
||||
"github.com/milvus-io/milvus/pkg/util/crypto"
|
||||
"github.com/milvus-io/milvus/pkg/util/merr"
|
||||
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
||||
)
|
||||
|
||||
type GrpcAccessInfoSuite struct {
|
||||
@ -148,6 +149,14 @@ func (s *GrpcAccessInfoSuite) TestExpression() {
|
||||
s.Equal(testExpr, result[0])
|
||||
}
|
||||
|
||||
func (s *GrpcAccessInfoSuite) TestClusterPrefix() {
|
||||
cluster := "instance-test"
|
||||
paramtable.Init()
|
||||
paramtable.Get().Save(paramtable.Get().CommonCfg.ClusterPrefix.Key, cluster)
|
||||
result := s.info.Get("$cluster_prefix")
|
||||
s.Equal(cluster, result[0])
|
||||
}
|
||||
|
||||
func TestGrpcAccssInfo(t *testing.T) {
|
||||
suite.Run(t, new(GrpcAccessInfoSuite))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user