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 LogRequest variable to config input (#5197) #7085

Merged
merged 2 commits into from
Dec 10, 2020

Conversation

OmarAyo
Copy link
Contributor

@OmarAyo OmarAyo commented Dec 8, 2020

(cherry picked from commit 449c06b)


This change is Reviewable

Fixes: DGRAPH-1123

This PR adds support for logRequest config param. logRequest can have true/false values. True
value of logRequest enables logging of all requests coming to alphas. False value of logRequest
disables it.
Users will be able to dynamically change this param using graphql admin endpoint.
Sample query:

mutation {
  config(input: {logRequest: true}){
    response {
      code
      message
    }
  }
}
Internally we have added one more field in WorkerOptions(WorkerConfig) called as LogRequest
of int32 type. Value of this field is checked atomically upon every request arrival. If value of
LogRequest is 1, it results in logging of requests.


Co-authored-by: Ashish Goswami <[email protected]>
(cherry picked from commit 449c06b)
…888) (#7103)

Fixes GRAPHQL-888.
Previously, if you ran this request:
```
$ curl -H "Content-Type: application/json" http://localhost:8080/admin -d '{"query": "mutation {config(input: {logRequest: false}){response {code message}}}"}'
```
Alpha logs would also print this:
```
I1205 22:22:51.684693 2681396 middlewares.go:178] GraphQL admin mutation. Name =  config
I1205 22:22:51.684724 2681396 config.go:38] Got config update through GraphQL admin API
I1205 22:22:51.684810 2681396 worker.go:138] Updating cacheMb to 0
```
Indicating that cacheMb was also updated, even it wasn't specified in the request.

This PR fixes this issue.

(cherry picked from commit c03c327)

# Conflicts:
#	graphql/admin/config.go
Copy link
Contributor

@abhimanyusinghgaur abhimanyusinghgaur 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 5 files reviewed, all discussions resolved (waiting on @abhimanyusinghgaur, @danielmai, and @manishrjain)

@OmarAyo OmarAyo merged commit 07b87c2 into release/v20.03 Dec 10, 2020
@OmarAyo OmarAyo deleted the omar/cherry-pick-queryLogging branch December 10, 2020 11:21
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.

3 participants