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

Chore(GraphQL): Fix query logging for mutations in case of panic #7646

Merged
merged 1 commit into from
Mar 24, 2021

Conversation

vmrajas
Copy link
Contributor

@vmrajas vmrajas commented Mar 24, 2021

This adds logging for mutations in case of panic.

Testing:
Tested Locally

=== RUN   TestRunAll_Normal/panic_catcher/mutation
E0324 18:20:07.423360  955317 panics.go:34] panic: 
****
this test should trap this panic.
It's working as expected if this message is logged with a stack trace
****.
 query: mutation {
						addCountry(input: [{ name: "A Country" }]) { country { id } }
					}
 trace: goroutine 5272 [running]:

Fixes GRAPHQL-1062


This change is Reviewable

@vmrajas vmrajas requested a review from pawanrawal as a code owner March 24, 2021 12:53
@github-actions github-actions bot added the area/graphql Issues related to GraphQL support on Dgraph. label Mar 24, 2021
// Panic Handler for mutation. This ensures that the mutation which causes panic
// gets logged in Alpha logs. This panic handler overrides the default Panic Handler
// used in recoveryHandler in admin/http.go
defer api.PanicHandler(
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should also add a comment about why we can't merge this defer with the other defer. That would be really helpful for anyone else to get context.

@vmrajas vmrajas merged commit d5299b9 into release/v21.03 Mar 24, 2021
@vmrajas vmrajas deleted the rajas/fix_query_logging_for_mutations branch March 24, 2021 14:25
aman-bansal pushed a commit that referenced this pull request Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/graphql Issues related to GraphQL support on Dgraph.
Development

Successfully merging this pull request may close these issues.

2 participants