Merge pull request #1908 from molecula/log-index

log index with query for grpc
This commit is contained in:
reese 2022-02-04 16:53:39 -06:00 committed by GitHub
commit e8c123ca23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -216,7 +216,7 @@ package for linux amd64:
GOARCH: "amd64"
script:
- echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
- apt update && apt install nfpm
- apt update && apt install nfpm=2.11.3
- make package
artifacts:
paths:
@ -233,7 +233,7 @@ package for linux arm64:
GOARCH: "arm64"
script:
- echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
- apt update && apt install nfpm
- apt update && apt install nfpm=2.11.3
- make package
artifacts:
paths:

View file

@ -1645,7 +1645,7 @@ func LogQuery(ctx context.Context, method string, req interface{}, logger logger
}
switch r := req.(type) {
case *pb.QueryPQLRequest:
logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Pql)
logger.Infof("GRPC: %v, %v, %v, %v, %v, [%s]%s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Index, r.Pql)
case *pb.QuerySQLRequest:
logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Sql)
default:

View file

@ -1453,8 +1453,8 @@ func TestLogQuery(t *testing.T) {
},
{
name: "QueryPQLReq",
req: &pb.QueryPQLRequest{Pql: "Count(All())"},
expected: fmt.Sprintf("GRPC: %v, %v, %v, %v, %v, %v\n", "", []string{}, "test!", uinfo.UserID, uinfo.UserName, "Count(All())"),
req: &pb.QueryPQLRequest{Index: "index", Pql: "Count(All())"},
expected: fmt.Sprintf("GRPC: %v, %v, %v, %v, %v, %v\n", "", []string{}, "test!", uinfo.UserID, uinfo.UserName, "[index]Count(All())"),
},
}
for _, test := range cases {