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

[Feature] Query Log #4944

Closed
MichelDiz opened this issue Mar 16, 2020 · 2 comments · Fixed by #5024
Closed

[Feature] Query Log #4944

MichelDiz opened this issue Mar 16, 2020 · 2 comments · Fixed by #5024
Labels
area/operations Related to operational aspects of the DB, including signals, flags, env vars, etc. kind/feature Something completely new we should consider. status/accepted We accept to investigate/work on it.

Comments

@MichelDiz
Copy link
Contributor

MichelDiz commented Mar 16, 2020

Experience Report

What you wanted to do

Analyze if my query generated any problems in my cluster Or if third devs have abused with too complex queries without analyzing the capacity of the cluster. Without having to use Jaeger Tracing.

It can be useful for those who have no skill with tracing.

What you actually did

Hard to debug without Jaeger or clues (like logs).

Why that wasn't great, with examples

Sometimes (Is not always) when I make queries too complex, with many features and wide parameters. My cluster crash. A clue via logs can help start debugging.

I added it to the backlog, if it is not feasible, please close this issue.

BTW, it would be interesting for this logging to be separated from the main Dgraph binary log. Something like Prometheus(?) or a file. We add a flag that appends query logs to a file.

@MichelDiz MichelDiz added kind/feature Something completely new we should consider. status/accepted We accept to investigate/work on it. area/operations Related to operational aspects of the DB, including signals, flags, env vars, etc. labels Mar 16, 2020
@MichelDiz
Copy link
Contributor Author

A temporary solution from @danielmai 5dfc30a

@MichelDiz
Copy link
Contributor Author

MichelDiz commented Mar 19, 2020

Maybe this could be in a kind of "Event Sourcing". Related to #2122

Or even maybe create a kind of "Event Sourcing" to Dgraph in Badger. And give users access via the Debug tool.

danielmai added a commit that referenced this issue Apr 1, 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 issue 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 issue 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
area/operations Related to operational aspects of the DB, including signals, flags, env vars, etc. kind/feature Something completely new we should consider. status/accepted We accept to investigate/work on it.
Development

Successfully merging a pull request may close this issue.

1 participant