fixed bug in logging high complexity query rejections #581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A bug was introduced as part of #574 where we were attempting to log some fields that hadn't yet been populated from the buffer. This would result in nil pointer errors, panics, and/or empty logged fields. This manifested as the following error in the console when a cypher query exceeded the maximum complexity threshold:
The changes in this MR will populate all fields to be logged, before the log event is set up.
How Has This Been Tested?
Forced a query to exceed maximum complexity threshold by making the complexity analyzer (
QueryComplexity
function) return a high valueRan a cypher query- this would trip the max complexity threshold and go into the high complexity log codepath. Error is shown at the bottom of the screen as expected.
Verified that the panic does not occur, and all expected fields are logged correctly
The other logging change sent out as part of the previous MR was related to neo4j timeouts. So I followed a similar strategy to force a neo4j timeout to occur, and verified that no nil pointers are thrown in that codepath.
Types of changes
Checklist: