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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
32eaf46e
Commit
32eaf46e
authored
Jul 17, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't track cached queries in Gitlab::PerformanceBar::PeekQueryTracker
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
1bd140ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
lib/gitlab/performance_bar/peek_query_tracker.rb
lib/gitlab/performance_bar/peek_query_tracker.rb
+8
-1
No files found.
lib/gitlab/performance_bar/peek_query_tracker.rb
View file @
32eaf46e
# Inspired by https://github.com/peek/peek-pg/blob/master/lib/peek/views/pg.rb
# PEEK_DB_CLIENT is a constant set in config/initializers/peek.rb
module
Gitlab
module
PerformanceBar
module
PeekQueryTracker
...
...
@@ -23,10 +24,16 @@ module Gitlab
subscribe
(
'sql.active_record'
)
do
|
_
,
start
,
finish
,
_
,
data
|
if
RequestStore
.
active?
&&
RequestStore
.
store
[
:peek_enabled
]
# data[:cached] is only available starting from Rails 5.1.0
# https://github.com/rails/rails/blob/v5.1.0/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L113
# Before that, data[:name] was set to 'CACHE'
# https://github.com/rails/rails/blob/v4.2.9/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb#L80
unless
data
.
fetch
(
:cached
,
data
[
:name
]
==
'CACHE'
)
track_query
(
data
[
:sql
].
strip
,
data
[
:binds
],
start
,
finish
)
end
end
end
end
def
track_query
(
raw_query
,
bindings
,
start
,
finish
)
query
=
Gitlab
::
Sherlock
::
Query
.
new
(
raw_query
,
start
,
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