BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7e6f0ac0
Unverified
Commit
7e6f0ac0
authored
Apr 18, 2016
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Count the number of SQL queries per transaction
Fixes gitlab-org/gitlab-ce#15335
parent
06952aaf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
0 deletions
+5
-0
CHANGELOG
CHANGELOG
+1
-0
active_record.rb
lib/gitlab/metrics/subscribers/active_record.rb
+1
-0
active_record_spec.rb
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
+3
-0
No files found.
CHANGELOG
View file @
7e6f0ac0
...
...
@@ -4,6 +4,7 @@ v 8.7.0 (unreleased)
- Method instrumentation now uses Module#prepend instead of aliasing methods
- Repository.clean_old_archives is now instrumented
- Add support for environment variables on a job level in CI configuration file
- SQL query counts are now tracked per transaction
- The Projects::HousekeepingService class has extra instrumentation
- All service classes (those residing in app/services) are now instrumented
- Developers can now add custom tags to transactions
...
...
lib/gitlab/metrics/subscribers/active_record.rb
View file @
7e6f0ac0
...
...
@@ -9,6 +9,7 @@ module Gitlab
return
unless
current_transaction
current_transaction
.
increment
(
:sql_duration
,
event
.
duration
)
current_transaction
.
increment
(
:sql_count
,
1
)
end
private
...
...
spec/lib/gitlab/metrics/subscribers/active_record_spec.rb
View file @
7e6f0ac0
...
...
@@ -28,6 +28,9 @@ describe Gitlab::Metrics::Subscribers::ActiveRecord do
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:sql_duration
,
0.2
)
expect
(
transaction
).
to
receive
(
:increment
).
with
(
:sql_count
,
1
)
subscriber
.
sql
(
event
)
end
end
...
...
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