mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
enhance: access log support print output fields of Query or Search (#30768)
Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
parent
3b5ce73ded
commit
0dacf0172e
@ -49,6 +49,7 @@ var metricFuncMap = map[string]getMetricFunc{
|
||||
"$time_start": getTimeStart,
|
||||
"$time_end": getTimeEnd,
|
||||
"$method_expr": getExpr,
|
||||
"$output_fields": getOutputFields,
|
||||
"$sdk_version": getSdkVersion,
|
||||
"$cluster_prefix": getClusterPrefix,
|
||||
}
|
||||
|
@ -302,3 +302,11 @@ func getSdkVersionByUserAgent(ctx context.Context) string {
|
||||
func getClusterPrefix(i *GrpcAccessInfo) string {
|
||||
return paramtable.Get().CommonCfg.ClusterPrefix.GetValue()
|
||||
}
|
||||
|
||||
func getOutputFields(i *GrpcAccessInfo) string {
|
||||
fields, ok := requestutil.GetOutputFieldsFromRequest(i.req)
|
||||
if ok {
|
||||
return fmt.Sprint(fields.([]string))
|
||||
}
|
||||
return unknownString
|
||||
}
|
||||
|
@ -178,6 +178,18 @@ func (s *GrpcAccessInfoSuite) TestExpression() {
|
||||
s.Equal(testExpr, result[0])
|
||||
}
|
||||
|
||||
func (s *GrpcAccessInfoSuite) TestOutputFields() {
|
||||
result := s.info.Get("$output_fields")
|
||||
s.Equal(unknownString, result[0])
|
||||
|
||||
fileds := []string{"pk"}
|
||||
s.info.req = &milvuspb.QueryRequest{
|
||||
OutputFields: fileds,
|
||||
}
|
||||
result = s.info.Get("$output_fields")
|
||||
s.Equal(fmt.Sprint(fileds), result[0])
|
||||
}
|
||||
|
||||
func (s *GrpcAccessInfoSuite) TestClusterPrefix() {
|
||||
cluster := "instance-test"
|
||||
paramtable.Init()
|
||||
|
Loading…
Reference in New Issue
Block a user