File tree Expand file tree Collapse file tree 5 files changed +86
-2
lines changed
internal/proxy/accesslog/info Expand file tree Collapse file tree 5 files changed +86
-2
lines changed Original file line number Diff line number Diff line change @@ -315,10 +315,10 @@ proxy:
315
315
base :
316
316
format : " [$time_now] [ACCESS] <$user_name: $user_addr> $method_name [status: $method_status] [code: $error_code] [sdk: $sdk_version] [msg: $error_msg] [traceID: $trace_id] [timeCost: $time_cost]"
317
317
query :
318
- format : " [$time_now] [ACCESS] <$user_name: $user_addr> $method_name [status: $method_status] [code: $error_code] [sdk: $sdk_version] [msg: $error_msg] [traceID: $trace_id] [timeCost: $time_cost] [database: $database_name] [collection: $collection_name] [partitions: $partition_name] [expr: $method_expr]"
318
+ format : " [$time_now] [ACCESS] <$user_name: $user_addr> $method_name [status: $method_status] [code: $error_code] [sdk: $sdk_version] [msg: $error_msg] [traceID: $trace_id] [timeCost: $time_cost] [database: $database_name] [collection: $collection_name] [partitions: $partition_name] [expr: $method_expr] [params: $query_params] "
319
319
methods : " Query, Delete"
320
320
search :
321
- format : " [$time_now] [ACCESS] <$user_name: $user_addr> $method_name [status: $method_status] [code: $error_code] [sdk: $sdk_version] [msg: $error_msg] [traceID: $trace_id] [timeCost: $time_cost] [database: $database_name] [collection: $collection_name] [partitions: $partition_name] [anns_field : $anns_field ] [expr : $method_expr ]"
321
+ format : " [$time_now] [ACCESS] <$user_name: $user_addr> $method_name [status: $method_status] [code: $error_code] [sdk: $sdk_version] [msg: $error_msg] [traceID: $trace_id] [timeCost: $time_cost] [database: $database_name] [collection: $collection_name] [partitions: $partition_name] [expr : $method_expr ] [nq : $nq] [params: $search_params ]"
322
322
methods : " HybridSearch, Search"
323
323
cacheSize : 0 # Size of log of write cache, in byte. (Close write cache if size was 0)
324
324
cacheFlushInterval : 3 # time interval of auto flush write cache, in seconds. (Close auto flush if interval was 0)
Original file line number Diff line number Diff line change @@ -316,3 +316,32 @@ func (i *GrpcAccessInfo) AnnsField() string {
316
316
}
317
317
return Unknown
318
318
}
319
+
320
+ func (i * GrpcAccessInfo ) NQ () string {
321
+ if req , ok := i .req .(* milvuspb.SearchRequest ); ok {
322
+ return fmt .Sprint (req .GetNq ())
323
+ }
324
+
325
+ if req , ok := i .req .(* milvuspb.HybridSearchRequest ); ok {
326
+ return listToString (lo .Map (req .GetRequests (), func (req * milvuspb.SearchRequest , _ int ) string { return fmt .Sprint (req .GetNq ()) }))
327
+ }
328
+ return Unknown
329
+ }
330
+
331
+ func (i * GrpcAccessInfo ) SearchParams () string {
332
+ if req , ok := i .req .(* milvuspb.SearchRequest ); ok {
333
+ return kvsToString (req .GetSearchParams ())
334
+ }
335
+
336
+ if req , ok := i .req .(* milvuspb.HybridSearchRequest ); ok {
337
+ return listToString (lo .Map (req .GetRequests (), func (req * milvuspb.SearchRequest , _ int ) string { return kvsToString (req .GetSearchParams ()) }))
338
+ }
339
+ return Unknown
340
+ }
341
+
342
+ func (i * GrpcAccessInfo ) QueryParams () string {
343
+ if req , ok := i .req .(* milvuspb.QueryRequest ); ok {
344
+ return kvsToString (req .GetQueryParams ())
345
+ }
346
+ return Unknown
347
+ }
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ var MetricFuncMap = map[string]getMetricFunc{
48
48
"$cluster_prefix" : getClusterPrefix ,
49
49
"$consistency_level" : getConsistencyLevel ,
50
50
"$anns_field" : getAnnsField ,
51
+ "$nq" : getNq ,
52
+ "$search_params" : getSearchParams ,
53
+ "$query_params" : getQueryParams ,
51
54
}
52
55
53
56
type AccessInfo interface {
@@ -72,6 +75,9 @@ type AccessInfo interface {
72
75
OutputFields () string
73
76
SdkVersion () string
74
77
ConsistencyLevel () string
78
+ NQ () string
79
+ SearchParams () string
80
+ QueryParams () string
75
81
}
76
82
77
83
func Get (i AccessInfo , keys ... string ) []any {
@@ -174,3 +180,15 @@ func getAnnsField(i AccessInfo) string {
174
180
func getClusterPrefix (i AccessInfo ) string {
175
181
return ClusterPrefix .Load ()
176
182
}
183
+
184
+ func getNq (i AccessInfo ) string {
185
+ return i .NQ ()
186
+ }
187
+
188
+ func getSearchParams (i AccessInfo ) string {
189
+ return i .SearchParams ()
190
+ }
191
+
192
+ func getQueryParams (i AccessInfo ) string {
193
+ return i .QueryParams ()
194
+ }
Original file line number Diff line number Diff line change @@ -226,3 +226,32 @@ func (i *RestfulInfo) AnnsField() string {
226
226
}
227
227
return Unknown
228
228
}
229
+
230
+ func (i * RestfulInfo ) NQ () string {
231
+ if req , ok := i .req .(* milvuspb.SearchRequest ); ok {
232
+ return fmt .Sprint (req .GetNq ())
233
+ }
234
+
235
+ if req , ok := i .req .(* milvuspb.HybridSearchRequest ); ok {
236
+ return listToString (lo .Map (req .GetRequests (), func (req * milvuspb.SearchRequest , _ int ) string { return fmt .Sprint (req .GetNq ()) }))
237
+ }
238
+ return Unknown
239
+ }
240
+
241
+ func (i * RestfulInfo ) SearchParams () string {
242
+ if req , ok := i .req .(* milvuspb.SearchRequest ); ok {
243
+ return kvsToString (req .GetSearchParams ())
244
+ }
245
+
246
+ if req , ok := i .req .(* milvuspb.HybridSearchRequest ); ok {
247
+ return listToString (lo .Map (req .GetRequests (), func (req * milvuspb.SearchRequest , _ int ) string { return kvsToString (req .GetSearchParams ()) }))
248
+ }
249
+ return Unknown
250
+ }
251
+
252
+ func (i * RestfulInfo ) QueryParams () string {
253
+ if req , ok := i .req .(* milvuspb.QueryRequest ); ok {
254
+ return kvsToString (req .GetQueryParams ())
255
+ }
256
+ return Unknown
257
+ }
Original file line number Diff line number Diff line change @@ -111,3 +111,11 @@ func listToString(strs []string) string {
111
111
}
112
112
return result + "]"
113
113
}
114
+
115
+ func kvsToString (kvs []* commonpb.KeyValuePair ) string {
116
+ str := "{"
117
+ for _ , kv := range kvs {
118
+ str += fmt .Sprintf ("%s:%s," , kv .GetKey (), kv .GetValue ())
119
+ }
120
+ return str + "}"
121
+ }
You can’t perform that action at this time.
0 commit comments