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
aac6b96b
Commit
aac6b96b
authored
Jul 12, 2021
by
Changzheng Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trace_memory_allocations FF
Changelog: removed
parent
40f818e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
81 deletions
+13
-81
config/feature_flags/development/trace_memory_allocations.yml
...ig/feature_flags/development/trace_memory_allocations.yml
+0
-8
lib/gitlab/memory/instrumentation.rb
lib/gitlab/memory/instrumentation.rb
+3
-14
spec/lib/gitlab/instrumentation_helper_spec.rb
spec/lib/gitlab/instrumentation_helper_spec.rb
+0
-17
spec/lib/gitlab/memory/instrumentation_spec.rb
spec/lib/gitlab/memory/instrumentation_spec.rb
+10
-42
No files found.
config/feature_flags/development/trace_memory_allocations.yml
deleted
100644 → 0
View file @
40f818e6
---
name
:
trace_memory_allocations
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52306
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/299524
milestone
:
'
13.9'
type
:
development
group
:
group::memory
default_enabled
:
true
lib/gitlab/memory/instrumentation.rb
View file @
aac6b96b
...
...
@@ -21,24 +21,13 @@ module Gitlab
Thread
.
current
.
respond_to?
(
:memory_allocations
)
end
# This method changes a global state
def
self
.
ensure_feature_flag!
def
self
.
start_thread_memory_allocations
return
unless
available?
enabled
=
Feature
.
enabled?
(
:trace_memory_allocations
,
default_enabled:
true
)
return
if
enabled
==
Thread
.
trace_memory_allocations
MUTEX
.
synchronize
do
# This enables or disables feature dynamically
# based on a feature flag
Thread
.
trace_memory_allocations
=
enabled
# This method changes a global state
Thread
.
trace_memory_allocations
=
true
end
end
def
self
.
start_thread_memory_allocations
return
unless
available?
ensure_feature_flag!
# it will return `nil` if disabled
Thread
.
current
.
memory_allocations
...
...
spec/lib/gitlab/instrumentation_helper_spec.rb
View file @
aac6b96b
...
...
@@ -99,23 +99,6 @@ RSpec.describe Gitlab::InstrumentationHelper do
:mem_mallocs
)
end
context
'when trace_memory_allocations is disabled'
do
before
do
stub_feature_flags
(
trace_memory_allocations:
false
)
Gitlab
::
Memory
::
Instrumentation
.
ensure_feature_flag!
end
it
'does not log memory usage metrics'
do
subject
expect
(
payload
).
not_to
include
(
:mem_objects
,
:mem_bytes
,
:mem_mallocs
)
end
end
end
context
'when load balancing is enabled'
do
...
...
spec/lib/gitlab/memory/instrumentation_spec.rb
View file @
aac6b96b
...
...
@@ -18,24 +18,8 @@ RSpec.describe Gitlab::Memory::Instrumentation do
describe
'.start_thread_memory_allocations'
do
subject
{
described_class
.
start_thread_memory_allocations
}
context
'when feature flag trace_memory_allocations is enabled'
do
before
do
stub_feature_flags
(
trace_memory_allocations:
true
)
end
it
'a hash is returned'
do
is_expected
.
not_to
be_empty
end
end
context
'when feature flag trace_memory_allocations is disabled'
do
before
do
stub_feature_flags
(
trace_memory_allocations:
false
)
end
it
'a nil is returned'
do
is_expected
.
to
be_nil
end
it
'a hash is returned'
do
is_expected
.
to
be_a
(
Hash
)
end
context
'when feature is unavailable'
do
...
...
@@ -63,30 +47,14 @@ RSpec.describe Gitlab::Memory::Instrumentation do
expect
(
described_class
).
to
receive
(
:measure_thread_memory_allocations
).
and_call_original
end
context
'when feature flag trace_memory_allocations is enabled'
do
before
do
stub_feature_flags
(
trace_memory_allocations:
true
)
end
it
'a hash is returned'
do
result
=
subject
expect
(
result
).
to
include
(
mem_objects:
be
>
1000
,
mem_mallocs:
be
>
1000
,
mem_bytes:
be
>
100_000
,
# 100 items * 100 bytes each
mem_total_bytes:
eq
(
result
[
:mem_bytes
]
+
40
*
result
[
:mem_objects
])
)
end
end
context
'when feature flag trace_memory_allocations is disabled'
do
before
do
stub_feature_flags
(
trace_memory_allocations:
false
)
end
it
'a nil is returned'
do
is_expected
.
to
be_nil
end
it
'a hash is returned'
do
result
=
subject
expect
(
result
).
to
include
(
mem_objects:
be
>
1000
,
mem_mallocs:
be
>
1000
,
mem_bytes:
be
>
100_000
,
# 100 items * 100 bytes each
mem_total_bytes:
eq
(
result
[
:mem_bytes
]
+
40
*
result
[
:mem_objects
])
)
end
context
'when feature is unavailable'
do
...
...
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