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
307ad060
Commit
307ad060
authored
May 13, 2020
by
Matthias Käppler
Committed by
Rémy Coutable
May 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename memory_usage to memory_usage_rss
To be more in line with _uss_pss
parent
e9500f28
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
17 additions
and
16 deletions
+17
-16
changelogs/unreleased/216584-drop-ruby-memory-bytes.yml
changelogs/unreleased/216584-drop-ruby-memory-bytes.yml
+5
-0
doc/administration/monitoring/prometheus/gitlab_metrics.md
doc/administration/monitoring/prometheus/gitlab_metrics.md
+0
-1
lib/gitlab/metrics/samplers/influx_sampler.rb
lib/gitlab/metrics/samplers/influx_sampler.rb
+1
-1
lib/gitlab/metrics/samplers/ruby_sampler.rb
lib/gitlab/metrics/samplers/ruby_sampler.rb
+1
-4
lib/gitlab/metrics/system.rb
lib/gitlab/metrics/system.rb
+1
-1
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+2
-2
lib/gitlab/utils/measuring.rb
lib/gitlab/utils/measuring.rb
+1
-1
spec/lib/gitlab/metrics/samplers/influx_sampler_spec.rb
spec/lib/gitlab/metrics/samplers/influx_sampler_spec.rb
+1
-1
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+1
-1
spec/lib/gitlab/metrics/system_spec.rb
spec/lib/gitlab/metrics/system_spec.rb
+4
-4
No files found.
changelogs/unreleased/216584-drop-ruby-memory-bytes.yml
0 → 100644
View file @
307ad060
---
title
:
Remove ruby_memory_bytes metric, duplicate of ruby_process_resident_memory_bytes
merge_request
:
31705
author
:
type
:
removed
doc/administration/monitoring/prometheus/gitlab_metrics.md
View file @
307ad060
...
@@ -183,7 +183,6 @@ Some basic Ruby runtime metrics are available:
...
@@ -183,7 +183,6 @@ Some basic Ruby runtime metrics are available:
|
`ruby_gc_duration_seconds`
| Counter | 11.1 | Time spent by Ruby in GC |
|
`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_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_file_descriptors`
| Gauge | 11.1 | File descriptors per process |
|
`ruby_memory_bytes`
| Gauge | 11.1 | Memory usage by process |
|
`ruby_sampler_duration_seconds`
| Counter | 11.1 | Time spent collecting stats |
|
`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_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_max_fds`
| Gauge | 12.0 | Maximum number of open file descriptors per process |
...
...
lib/gitlab/metrics/samplers/influx_sampler.rb
View file @
307ad060
...
@@ -31,7 +31,7 @@ module Gitlab
...
@@ -31,7 +31,7 @@ module Gitlab
end
end
def
sample_memory_usage
def
sample_memory_usage
add_metric
(
'memory_usage'
,
value:
System
.
memory_usage
)
add_metric
(
'memory_usage'
,
value:
System
.
memory_usage
_rss
)
end
end
def
sample_file_descriptors
def
sample_file_descriptors
...
...
lib/gitlab/metrics/samplers/ruby_sampler.rb
View file @
307ad060
...
@@ -35,7 +35,6 @@ module Gitlab
...
@@ -35,7 +35,6 @@ module Gitlab
def
init_metrics
def
init_metrics
metrics
=
{
metrics
=
{
file_descriptors:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:file
,
:descriptors
),
'File descriptors used'
,
labels
),
file_descriptors:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:file
,
:descriptors
),
'File descriptors used'
,
labels
),
memory_bytes:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:memory
,
:bytes
),
'Memory used (RSS)'
,
labels
),
process_cpu_seconds_total:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:cpu_seconds_total
),
'Process CPU seconds total'
),
process_cpu_seconds_total:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:cpu_seconds_total
),
'Process CPU seconds total'
),
process_max_fds:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:max_fds
),
'Process max fds'
),
process_max_fds:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:max_fds
),
'Process max fds'
),
process_resident_memory_bytes:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:resident_memory_bytes
),
'Memory used (RSS)'
,
labels
),
process_resident_memory_bytes:
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:process
,
:resident_memory_bytes
),
'Memory used (RSS)'
,
labels
),
...
@@ -87,9 +86,7 @@ module Gitlab
...
@@ -87,9 +86,7 @@ module Gitlab
end
end
def
set_memory_usage_metrics
def
set_memory_usage_metrics
memory_rss
=
System
.
memory_usage
metrics
[
:process_resident_memory_bytes
].
set
(
labels
,
System
.
memory_usage_rss
)
metrics
[
:memory_bytes
].
set
(
labels
,
memory_rss
)
metrics
[
:process_resident_memory_bytes
].
set
(
labels
,
memory_rss
)
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'enable_memory_uss_pss'
])
if
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'enable_memory_uss_pss'
])
memory_uss_pss
=
System
.
memory_usage_uss_pss
memory_uss_pss
=
System
.
memory_usage_uss_pss
...
...
lib/gitlab/metrics/system.rb
View file @
307ad060
...
@@ -18,7 +18,7 @@ module Gitlab
...
@@ -18,7 +18,7 @@ module Gitlab
MAX_OPEN_FILES_PATTERN
=
/Max open files\s*(?<value>\d+)/
.
freeze
MAX_OPEN_FILES_PATTERN
=
/Max open files\s*(?<value>\d+)/
.
freeze
# Returns the current process' RSS (resident set size) in bytes.
# Returns the current process' RSS (resident set size) in bytes.
def
self
.
memory_usage
def
self
.
memory_usage
_rss
sum_matches
(
PROC_STATUS_PATH
,
rss:
RSS_PATTERN
)[
:rss
].
kilobytes
sum_matches
(
PROC_STATUS_PATH
,
rss:
RSS_PATTERN
)[
:rss
].
kilobytes
end
end
...
...
lib/gitlab/metrics/transaction.rb
View file @
307ad060
...
@@ -55,13 +55,13 @@ module Gitlab
...
@@ -55,13 +55,13 @@ module Gitlab
def
run
def
run
Thread
.
current
[
THREAD_KEY
]
=
self
Thread
.
current
[
THREAD_KEY
]
=
self
@memory_before
=
System
.
memory_usage
@memory_before
=
System
.
memory_usage
_rss
@started_at
=
System
.
monotonic_time
@started_at
=
System
.
monotonic_time
@thread_cputime_start
=
System
.
thread_cpu_time
@thread_cputime_start
=
System
.
thread_cpu_time
yield
yield
ensure
ensure
@memory_after
=
System
.
memory_usage
@memory_after
=
System
.
memory_usage
_rss
@finished_at
=
System
.
monotonic_time
@finished_at
=
System
.
monotonic_time
self
.
class
.
gitlab_transaction_cputime_seconds
.
observe
(
labels
,
thread_cpu_duration
)
self
.
class
.
gitlab_transaction_cputime_seconds
.
observe
(
labels
,
thread_cpu_duration
)
...
...
lib/gitlab/utils/measuring.rb
View file @
307ad060
...
@@ -36,7 +36,7 @@ module Gitlab
...
@@ -36,7 +36,7 @@ module Gitlab
gc_stats:
gc_stats
,
gc_stats:
gc_stats
,
time_to_finish:
time_to_finish
,
time_to_finish:
time_to_finish
,
number_of_sql_calls:
sql_calls_count
,
number_of_sql_calls:
sql_calls_count
,
memory_usage:
"
#{
Gitlab
::
Metrics
::
System
.
memory_usage
.
to_f
/
1024
/
1024
}
MiB"
,
memory_usage:
"
#{
Gitlab
::
Metrics
::
System
.
memory_usage
_rss
.
to_f
/
1024
/
1024
}
MiB"
,
label:
::
Prometheus
::
PidProvider
.
worker_id
label:
::
Prometheus
::
PidProvider
.
worker_id
)
)
...
...
spec/lib/gitlab/metrics/samplers/influx_sampler_spec.rb
View file @
307ad060
...
@@ -37,7 +37,7 @@ describe Gitlab::Metrics::Samplers::InfluxSampler do
...
@@ -37,7 +37,7 @@ describe Gitlab::Metrics::Samplers::InfluxSampler do
describe
'#sample_memory_usage'
do
describe
'#sample_memory_usage'
do
it
'adds a metric containing the memory usage'
do
it
'adds a metric containing the memory usage'
do
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:memory_usage
)
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:memory_usage
_rss
)
.
and_return
(
9000
)
.
and_return
(
9000
)
expect
(
sampler
).
to
receive
(
:add_metric
)
expect
(
sampler
).
to
receive
(
:add_metric
)
...
...
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
View file @
307ad060
...
@@ -21,7 +21,7 @@ describe Gitlab::Metrics::Samplers::RubySampler do
...
@@ -21,7 +21,7 @@ describe Gitlab::Metrics::Samplers::RubySampler do
describe
'#sample'
do
describe
'#sample'
do
it
'adds a metric containing the process resident memory bytes'
do
it
'adds a metric containing the process resident memory bytes'
do
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:memory_usage
).
and_return
(
9000
)
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:memory_usage
_rss
).
and_return
(
9000
)
expect
(
sampler
.
metrics
[
:process_resident_memory_bytes
]).
to
receive
(
:set
).
with
({},
9000
)
expect
(
sampler
.
metrics
[
:process_resident_memory_bytes
]).
to
receive
(
:set
).
with
({},
9000
)
...
...
spec/lib/gitlab/metrics/system_spec.rb
View file @
307ad060
...
@@ -64,11 +64,11 @@ describe Gitlab::Metrics::System do
...
@@ -64,11 +64,11 @@ describe Gitlab::Metrics::System do
SNIP
SNIP
end
end
describe
'.memory_usage'
do
describe
'.memory_usage
_rss
'
do
it
"returns the process' resident set size (RSS) in bytes"
do
it
"returns the process' resident set size (RSS) in bytes"
do
mock_existing_proc_file
(
'/proc/self/status'
,
proc_status
)
mock_existing_proc_file
(
'/proc/self/status'
,
proc_status
)
expect
(
described_class
.
memory_usage
).
to
eq
(
2527232
)
expect
(
described_class
.
memory_usage
_rss
).
to
eq
(
2527232
)
end
end
end
end
...
@@ -103,9 +103,9 @@ describe Gitlab::Metrics::System do
...
@@ -103,9 +103,9 @@ describe Gitlab::Metrics::System do
mock_missing_proc_file
mock_missing_proc_file
end
end
describe
'.memory_usage'
do
describe
'.memory_usage
_rss
'
do
it
'returns 0'
do
it
'returns 0'
do
expect
(
described_class
.
memory_usage
).
to
eq
(
0
)
expect
(
described_class
.
memory_usage
_rss
).
to
eq
(
0
)
end
end
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