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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
10f5446c
Commit
10f5446c
authored
Dec 11, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove RubySampler#sample_objects for performance as well
parent
e1a8e5a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
50 deletions
+0
-50
lib/gitlab/metrics/samplers/ruby_sampler.rb
lib/gitlab/metrics/samplers/ruby_sampler.rb
+0
-27
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
+0
-23
No files found.
lib/gitlab/metrics/samplers/ruby_sampler.rb
View file @
10f5446c
...
...
@@ -48,7 +48,6 @@ module Gitlab
def
sample
start_time
=
System
.
monotonic_time
sample_gc
sample_objects
metrics
[
:memory_usage
].
set
(
labels
,
System
.
memory_usage
)
metrics
[
:file_descriptors
].
set
(
labels
,
System
.
file_descriptor_count
)
...
...
@@ -68,32 +67,6 @@ module Gitlab
end
end
def
sample_objects
list_objects
.
each
do
|
name
,
count
|
metrics
[
:objects_total
].
set
(
labels
.
merge
(
class:
name
),
count
)
end
end
if
Metrics
.
mri?
def
list_objects
sample
=
Allocations
.
to_hash
counts
=
sample
.
each_with_object
({})
do
|
(
klass
,
count
),
hash
|
name
=
klass
.
name
next
unless
name
hash
[
name
]
=
count
end
# Symbols aren't allocated so we'll need to add those manually.
counts
[
'Symbol'
]
=
Symbol
.
all_symbols
.
length
counts
end
else
def
list_objects
end
end
def
worker_label
return
{}
unless
defined?
(
Unicorn
::
Worker
)
...
...
spec/lib/gitlab/metrics/samplers/ruby_sampler_spec.rb
View file @
10f5446c
...
...
@@ -11,7 +11,6 @@ describe Gitlab::Metrics::Samplers::RubySampler do
it
'samples various statistics'
do
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:memory_usage
)
expect
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:file_descriptor_count
)
expect
(
sampler
).
to
receive
(
:sample_objects
)
expect
(
sampler
).
to
receive
(
:sample_gc
)
sampler
.
sample
...
...
@@ -65,26 +64,4 @@ describe Gitlab::Metrics::Samplers::RubySampler do
sampler
.
sample
end
end
if
Gitlab
::
Metrics
.
mri?
describe
'#sample_objects'
do
it
'adds a metric containing the amount of allocated objects'
do
expect
(
sampler
.
metrics
[
:objects_total
]).
to
receive
(
:set
)
.
with
(
include
(
class:
anything
),
be
>
0
)
.
at_least
(
:once
)
.
and_call_original
sampler
.
sample
end
it
'ignores classes without a name'
do
expect
(
Allocations
).
to
receive
(
:to_hash
).
and_return
({
Class
.
new
=>
4
})
expect
(
sampler
.
metrics
[
:objects_total
]).
not_to
receive
(
:set
)
.
with
(
include
(
class:
'object_counts'
),
anything
)
sampler
.
sample
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