Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add query/mutation logging in glog V=3. #5024

Merged
merged 1 commit into from
Apr 1, 2020

Conversation

danielmai
Copy link
Contributor

@danielmai danielmai commented Mar 24, 2020

Closes #4944.

By setting -v=3 or --vmodule=server=3, then query/mutation logs will appear in the Alpha log.

Example:

Query (has query: field)

I0324 15:41:27.464042    9642 server.go:771] Got a query: query:"{ q(func: has(counter.val)) { uid, val: counter.val }}"

Mutation (has mutations: field)

I0324 15:41:27.474000    9642 server.go:771] Got a query: start_ts:20006 mutations:<set_nquads:"<0x1> <counter.val> \"11\"^^<xs:int> ." commit_now:true > commit_now:true

This change is Reviewable

@danielmai danielmai requested review from manishrjain and a team as code owners March 24, 2020 22:43
@sleto-it
Copy link
Contributor

Needs doc. However new section about logs can be handled as part of DGRAPH-1165

Copy link
Contributor

@animesh2049 animesh2049 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @manishrjain)

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: , just a question regarding new lines in the query.

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @danielmai and @manishrjain)


edgraph/server.go, line 771 at r1 (raw file):

	resp *api.Response, rerr error) {
	if glog.V(3) {
		glog.Infof("Got a query: %+v", req)

will new lines in the query be printed as new lines in the log? If they do the query should be stripped of new lines to make sure the log is all in a single line.

@danielmai
Copy link
Contributor Author


edgraph/server.go, line 771 at r1 (raw file):

Previously, martinmr (Martin Martinez Rivera) wrote…

will new lines in the query be printed as new lines in the log? If they do the query should be stripped of new lines to make sure the log is all in a single line.

Good point. Logs are always in a single line. Queries have \n for newlines. e.g.,

I0401 19:59:26.541382      16 server.go:771] Got a query: query:"query {\n  getGQLSchema(func: type(dgraph.graphql)) {\n    id :
uid\n    schema : dgraph.graphql.schema\n    dgraph.uid : uid\n  }\n}" read_only:true

@danielmai danielmai merged commit a3f9647 into master Apr 1, 2020
@danielmai danielmai deleted the danielmai/glog-v3-query-log branch April 1, 2020 20:07
danielmai added a commit that referenced this pull request Apr 24, 2020
Closes #4944.

By setting `-v=3` or `--vmodule=server=3`, then query/mutation logs will appear in the Alpha log.

Examples:

Query (has `query:` field)
```
I0324 15:41:27.464042    9642 server.go:771] Got a query: query:"{ q(func: has(counter.val)) { uid, val: counter.val }}"
I0401 19:59:26.541382      16 server.go:771] Got a query: query:"query {\n  getGQLSchema(func: type(dgraph.graphql)) {\n    id :
uid\n    schema : dgraph.graphql.schema\n    dgraph.uid : uid\n  }\n}" read_only:true
```

Mutation (has `mutations:` field)
```
I0324 15:41:27.474000    9642 server.go:771] Got a query: start_ts:20006 mutations:<set_nquads:"<0x1> <counter.val> \"11\"^^<xs:int> ." commit_now:true > commit_now:true
```
danielmai added a commit that referenced this pull request Apr 24, 2020
Closes #4944.

By setting `-v=3` or `--vmodule=server=3`, then query/mutation logs will appear in the Alpha log.

Examples:

Query (has `query:` field)
```
I0324 15:41:27.464042    9642 server.go:771] Got a query: query:"{ q(func: has(counter.val)) { uid, val: counter.val }}"
I0401 19:59:26.541382      16 server.go:771] Got a query: query:"query {\n  getGQLSchema(func: type(dgraph.graphql)) {\n    id :
uid\n    schema : dgraph.graphql.schema\n    dgraph.uid : uid\n  }\n}" read_only:true
```

Mutation (has `mutations:` field)
```
I0324 15:41:27.474000    9642 server.go:771] Got a query: start_ts:20006 mutations:<set_nquads:"<0x1> <counter.val> \"11\"^^<xs:int> ." commit_now:true > commit_now:true
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Query Log
4 participants