Make sure to log query sha and referer when request fails

What does this MR do and why?

This MR fixes missing GLQL metadata in error logs when GraphQL execution fails.

For example, you can see that all the logs for failed GLQL requests are now missing glql_referer and glql_query_sha fields.

This made it impossible to build a Kibana Dashboard to identify problematic issues with timing out GLQL requests, which is needed to make a decision whether to enable the glql_load_on_click feature flag.

References

#535198 (closed)

Screenshots or screen recordings

Before After

How to set up and validate locally

  • Enable GLQL feature flag by running Feature.enable(:glql_integration) in rails console
  • Run tail -f log/development_json.log from gitlab folder
  • Find or create an issue in gdk and add there in a comment box or in a description any GLQL query and save it, for example:
```glql
display: table
fields: title, labels("workflow::*"), author, weight, assignees
query: group = "gitlab-org" and label != "bug::vulnerability"
```
  • In the tab where logs are running you should be able to see glql_referer and glql_query_sha
  • Do the same test for the fail flow, for example, you can add raise ActiveRecord::QueryAborted in Glql::BaseController#execute method and then make sure that glql_referer and glql_query_sha are still properly populated.

image

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Alisa Frunza

Merge request reports

Loading