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
3b0f8cc5
Commit
3b0f8cc5
authored
Jul 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
ed9a8239
433022f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
4 deletions
+29
-4
changelogs/unreleased/bjk-64064_cache_metrics.yml
changelogs/unreleased/bjk-64064_cache_metrics.yml
+5
-0
doc/administration/monitoring/prometheus/gitlab_metrics.md
doc/administration/monitoring/prometheus/gitlab_metrics.md
+3
-0
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+12
-3
spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb
spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb
+9
-1
No files found.
changelogs/unreleased/bjk-64064_cache_metrics.yml
0 → 100644
View file @
3b0f8cc5
---
title
:
Adjust redis cache metrics
merge_request
:
30572
author
:
type
:
changed
doc/administration/monitoring/prometheus/gitlab_metrics.md
View file @
3b0f8cc5
...
...
@@ -34,6 +34,9 @@ The following metrics are available:
| filesystem_writable | Gauge | 9.4 | Whether or not the filesystem is writable |
| filesystem_read_latency_seconds | Gauge | 9.4 | Read latency of a specific filesystem |
| filesystem_readable | Gauge | 9.4 | Whether or not the filesystem is readable |
| gitlab_cache_misses_total | Counter | 10.2 | Cache read miss |
| gitlab_cache_operation_duration_seconds | Histogram | 10.2 | Cache access time |
| gitlab_cache_operations_total | Counter | 12.2 | Cache operations by controller/action |
| http_requests_total | Counter | 9.4 | Rack request count |
| http_request_duration_seconds | Histogram | 9.4 | HTTP response time from rack middleware |
| pipelines_created_total | Counter | 9.4 | Counter of pipelines created |
...
...
lib/gitlab/metrics/subscribers/rails_cache.rb
View file @
3b0f8cc5
...
...
@@ -50,7 +50,8 @@ module Gitlab
def
observe
(
key
,
duration
)
return
unless
current_transaction
metric_cache_operation_duration_seconds
.
observe
(
current_transaction
.
labels
.
merge
({
operation:
key
}),
duration
/
1000.0
)
metric_cache_operations_total
.
increment
(
current_transaction
.
labels
.
merge
({
operation:
key
}))
metric_cache_operation_duration_seconds
.
observe
({
operation:
key
},
duration
/
1000.0
)
current_transaction
.
increment
(
:cache_duration
,
duration
,
false
)
current_transaction
.
increment
(
:cache_count
,
1
,
false
)
current_transaction
.
increment
(
"cache_
#{
key
}
_duration"
.
to_sym
,
duration
,
false
)
...
...
@@ -63,12 +64,20 @@ module Gitlab
Transaction
.
current
end
def
metric_cache_operations_total
@metric_cache_operations_total
||=
::
Gitlab
::
Metrics
.
counter
(
:gitlab_cache_operations_total
,
'Cache operations'
,
Transaction
::
BASE_LABELS
)
end
def
metric_cache_operation_duration_seconds
@metric_cache_operation_duration_seconds
||=
::
Gitlab
::
Metrics
.
histogram
(
:gitlab_cache_operation_duration_seconds
,
'Cache access time'
,
Transaction
::
BASE_LABELS
.
merge
({
action:
nil
})
,
[
0.00
1
,
0.01
,
0.1
,
1
,
1
0
]
{}
,
[
0.00
001
,
0.0001
,
0.001
,
0.01
,
0.1
,
1.
0
]
)
end
...
...
spec/lib/gitlab/metrics/subscribers/rails_cache_spec.rb
View file @
3b0f8cc5
...
...
@@ -201,7 +201,15 @@ describe Gitlab::Metrics::Subscribers::RailsCache do
it
'observes cache metric'
do
expect
(
subscriber
.
send
(
:metric_cache_operation_duration_seconds
))
.
to
receive
(
:observe
)
.
with
(
transaction
.
labels
.
merge
(
operation: :delete
),
event
.
duration
/
1000.0
)
.
with
({
operation: :delete
},
event
.
duration
/
1000.0
)
subscriber
.
observe
(
:delete
,
event
.
duration
)
end
it
'increments the operations total'
do
expect
(
subscriber
.
send
(
:metric_cache_operations_total
))
.
to
receive
(
:increment
)
.
with
(
transaction
.
labels
.
merge
(
operation: :delete
))
subscriber
.
observe
(
:delete
,
event
.
duration
)
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