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
40e9fbb2
Commit
40e9fbb2
authored
Sep 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rails cache metrics name alignment
parent
a8a5c337
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+8
-8
No files found.
lib/gitlab/metrics/subscribers/rails_cache.rb
View file @
40e9fbb2
...
@@ -6,9 +6,9 @@ module Gitlab
...
@@ -6,9 +6,9 @@ module Gitlab
class
RailsCache
<
ActiveSupport
::
Subscriber
class
RailsCache
<
ActiveSupport
::
Subscriber
attach_to
:active_support
attach_to
:active_support
def
self
.
metric_cache_duration_seconds
def
self
.
metric_cache_
operation_
duration_seconds
@metric_cache_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
@metric_cache_
operation_
duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
:gitlab_cache_duration_seconds
,
:gitlab_cache_
operation_
duration_seconds
,
'Cache access time'
,
'Cache access time'
,
{
action:
nil
,
operation:
nil
},
{
action:
nil
,
operation:
nil
},
[
0.001
,
0.002
,
0.005
,
0.01
,
0.02
,
0.05
,
0.1
,
0.500
,
2.0
,
10.0
]
[
0.001
,
0.002
,
0.005
,
0.01
,
0.02
,
0.05
,
0.1
,
0.500
,
2.0
,
10.0
]
...
@@ -31,10 +31,10 @@ module Gitlab
...
@@ -31,10 +31,10 @@ module Gitlab
if
event
.
payload
[
:hit
]
if
event
.
payload
[
:hit
]
self
.
class
.
metric_cache_read_hit_total
.
increment
({
action:
action
})
self
.
class
.
metric_cache_read_hit_total
.
increment
({
action:
action
})
current_transaction
.
increment
(
:cache_read_hit_count
,
1
)
current_transaction
.
increment
(
:cache_read_hit_count
,
1
,
false
)
else
else
self
.
class
.
metric_cache_read_miss_total
.
increment
({
action:
action
})
self
.
class
.
metric_cache_read_miss_total
.
increment
({
action:
action
})
current_transaction
.
increment
(
:cache_read_miss_count
,
1
)
current_transaction
.
increment
(
:cache_read_miss_count
,
1
,
false
)
end
end
end
end
...
@@ -67,11 +67,11 @@ module Gitlab
...
@@ -67,11 +67,11 @@ module Gitlab
def
observe
(
key
,
duration
)
def
observe
(
key
,
duration
)
return
unless
current_transaction
return
unless
current_transaction
self
.
class
.
metric_cache_duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.0
)
self
.
class
.
metric_cache_
operation_
duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.0
)
current_transaction
.
increment
(
:cache_duration
,
duration
,
false
)
current_transaction
.
increment
(
:cache_duration
,
duration
,
false
)
current_transaction
.
increment
(
:cache_count
,
1
,
false
)
current_transaction
.
increment
(
:cache_count
,
1
,
false
)
current_transaction
.
increment
(
"
#{
key
}
_duration"
.
to_sym
,
duration
,
false
)
current_transaction
.
increment
(
"
cache_
#{
key
}
_duration"
.
to_sym
,
duration
,
false
)
current_transaction
.
increment
(
"
#{
key
}
_count"
.
to_sym
,
1
,
false
)
current_transaction
.
increment
(
"
cache_
#{
key
}
_count"
.
to_sym
,
1
,
false
)
end
end
private
private
...
...
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