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
65e2d770
Commit
65e2d770
authored
May 13, 2020
by
Matthias Käppler
Committed by
Kamil Trzciński
May 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default enable_memory_uss_pss check to true + add docs
parent
a7b0553d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
+33
-12
changelogs/unreleased/216597-drop-uss-pss-env-var.yml
changelogs/unreleased/216597-drop-uss-pss-env-var.yml
+5
-0
doc/administration/monitoring/prometheus/gitlab_metrics.md
doc/administration/monitoring/prometheus/gitlab_metrics.md
+12
-10
lib/gitlab/metrics/samplers/ruby_sampler.rb
lib/gitlab/metrics/samplers/ruby_sampler.rb
+1
-1
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+15
-1
No files found.
changelogs/unreleased/216597-drop-uss-pss-env-var.yml
0 → 100644
View file @
65e2d770
---
title
:
Ruby metrics now include USS and PSS memory readings
merge_request
:
31707
author
:
type
:
added
doc/administration/monitoring/prometheus/gitlab_metrics.md
View file @
65e2d770
...
...
@@ -178,16 +178,18 @@ The following metrics are available:
Some basic Ruby runtime metrics are available:
| Metric | Type | Since | Description |
|:------------------------------------ |:--------- |:----- |:----------- |
|
`ruby_gc_duration_seconds`
| Counter | 11.1 | Time spent by Ruby in GC |
|
`ruby_gc_stat_...`
| Gauge | 11.1 | Various metrics from
[
GC.stat
](
https://ruby-doc.org/core-2.6.5/GC.html#method-c-stat
)
|
|
`ruby_file_descriptors`
| Gauge | 11.1 | File descriptors per process |
|
`ruby_sampler_duration_seconds`
| Counter | 11.1 | Time spent collecting stats |
|
`ruby_process_cpu_seconds_total`
| Gauge | 12.0 | Total amount of CPU time per process |
|
`ruby_process_max_fds`
| Gauge | 12.0 | Maximum number of open file descriptors per process |
|
`ruby_process_resident_memory_bytes`
| Gauge | 12.0 | Memory usage by process |
|
`ruby_process_start_time_seconds`
| Gauge | 12.0 | UNIX timestamp of process start time |
| Metric | Type | Since | Description |
|:---------------------------------------- |:--------- |:----- |:----------- |
|
`ruby_gc_duration_seconds`
| Counter | 11.1 | Time spent by Ruby in GC |
|
`ruby_gc_stat_...`
| Gauge | 11.1 | Various metrics from
[
GC.stat
](
https://ruby-doc.org/core-2.6.5/GC.html#method-c-stat
)
|
|
`ruby_file_descriptors`
| Gauge | 11.1 | File descriptors per process |
|
`ruby_sampler_duration_seconds`
| Counter | 11.1 | Time spent collecting stats |
|
`ruby_process_cpu_seconds_total`
| Gauge | 12.0 | Total amount of CPU time per process |
|
`ruby_process_max_fds`
| Gauge | 12.0 | Maximum number of open file descriptors per process |
|
`ruby_process_resident_memory_bytes`
| Gauge | 12.0 | Memory usage by process (RSS/Resident Set Size) |
|
`ruby_process_unique_memory_bytes`
| Gauge | 13.0 | Memory usage by process (USS/Unique Set Size) |
|
`ruby_process_proportional_memory_bytes`
| Gauge | 13.0 | Memory usage by process (PSS/Proportional Set Size) |
|
`ruby_process_start_time_seconds`
| Gauge | 12.0 | UNIX timestamp of process start time |
## Unicorn Metrics
...
...
lib/gitlab/metrics/samplers/ruby_sampler.rb
View file @
65e2d770
...
...
@@ -88,7 +88,7 @@ module Gitlab
def
set_memory_usage_metrics
metrics
[
:process_resident_memory_bytes
].
set
(
labels
,
System
.
memory_usage_rss
)
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'enable_memory_uss_pss'
])
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'enable_memory_uss_pss'
]
||
'1'
)
memory_uss_pss
=
System
.
memory_usage_uss_pss
metrics
[
:process_unique_memory_bytes
].
set
(
labels
,
memory_uss_pss
[
:uss
])
metrics
[
:process_proportional_memory_bytes
].
set
(
labels
,
memory_uss_pss
[
:pss
])
...
...
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
View file @
65e2d770
...
...
@@ -8,7 +8,6 @@ describe Gitlab::Metrics::Samplers::RubySampler do
before
do
allow
(
Gitlab
::
Metrics
::
NullMetric
).
to
receive
(
:instance
).
and_return
(
null_metric
)
stub_env
(
'enable_memory_uss_pss'
,
"1"
)
end
describe
'#initialize'
do
...
...
@@ -37,6 +36,21 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler
.
sample
end
context
'when USS+PSS sampling is disabled via environment'
do
before
do
stub_env
(
'enable_memory_uss_pss'
,
"0"
)
end
it
'does not sample USS or PSS'
do
expect
(
Gitlab
::
Metrics
::
System
).
not_to
receive
(
:memory_usage_uss_pss
)
expect
(
sampler
.
metrics
[
:process_unique_memory_bytes
]).
not_to
receive
(
:set
)
expect
(
sampler
.
metrics
[
:process_proportional_memory_bytes
]).
not_to
receive
(
:set
)
sampler
.
sample
end
end
it
'adds a metric containing the amount of open file descriptors'
do
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:file_descriptor_count
)
.
and_return
(
4
)
...
...
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