Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9e3c9e9a
Commit
9e3c9e9a
authored
Apr 20, 2020
by
Brett Walker
Committed by
Evan Read
Apr 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow-up from "Update doc/development/query_recorder.md"
parent
ea0fa636
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
65 deletions
+65
-65
doc/development/query_recorder.md
doc/development/query_recorder.md
+65
-65
No files found.
doc/development/query_recorder.md
View file @
9e3c9e9a
...
...
@@ -47,7 +47,7 @@ This could lead to false successes where subsequent "requests" could have querie
There are multiple ways to find the source of queries.
1.
The
`QueryRecorder`
`data`
attribute
stores queries by
`file_name:line_number:method_name`
.
-
Inspect the
`QueryRecorder`
`data`
attribute. It
stores queries by
`file_name:line_number:method_name`
.
Each entry is a
`hash`
with the following fields:
-
`count`
: the number of times a query from this
`file_name:line_number:method_name`
was called
...
...
@@ -64,11 +64,11 @@ There are multiple ways to find the source of queries.
`QueryRecorder#occurrences_by_line_method`
returns a sorted array based on
`data`
, sorted by
`count`
.
1.
You can output
the call backtrace for the specific
`QueryRecorder`
instance you want
-
View
the call backtrace for the specific
`QueryRecorder`
instance you want
by using
`ActiveRecord::QueryRecorder.new(query_recorder_debug: true)`
. The output
will be in
`test.log`
1.
Using the environment variable
`QUERY_RECORDER_DEBUG`
, the call backtrace will be output for all tests
.
-
Enable the call backtrace for all tests using the
`QUERY_RECORDER_DEBUG`
environment variable
.
To enable this, run the specs with the
`QUERY_RECORDER_DEBUG`
environment variable set. For example:
...
...
@@ -78,7 +78,7 @@ There are multiple ways to find the source of queries.
This will log calls to QueryRecorder into the
`test.log`
file. For example:
```
plaintext
```
sql
QueryRecorder
SQL
:
SELECT
COUNT
(
*
)
FROM
"issues"
WHERE
"issues"
.
"deleted_at"
IS
NULL
AND
"issues"
.
"project_id"
=
$
1
AND
(
"issues"
.
"state"
IN
(
'opened'
))
AND
"issues"
.
"confidential"
=
$
2
--> /home/user/gitlab/gdk/gitlab/spec/support/query_recorder.rb:19:in `callback'
--> /home/user/.rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/notifications/fanout.rb:127:in `finish'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment