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
Boxiang Sun
gitlab-ce
Commits
ca176a9b
Commit
ca176a9b
authored
Dec 11, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move call_measurement_enabled? method to the bottom of the file
parent
408208bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+11
-11
No files found.
lib/gitlab/metrics/method_call.rb
View file @
ca176a9b
...
...
@@ -20,17 +20,6 @@ module Gitlab
end
end
def
call_measurement_enabled?
expires_at
=
MEASUREMENT_ENABLED_CACHE_EXPIRES_AT
.
value
if
expires_at
<
Time
.
now
.
to_i
if
MEASUREMENT_ENABLED_CACHE_EXPIRES_AT
.
compare_and_set
(
expires_at
,
(
Time
.
now
+
30
.
seconds
).
to_i
)
MEASUREMENT_ENABLED_CACHE
.
value
=
Feature
.
get
(
:prometheus_metrics_method_instrumentation
).
enabled?
end
end
MEASUREMENT_ENABLED_CACHE
.
value
end
# name - The full name of the method (including namespace) such as
# `User#sign_in`.
#
...
...
@@ -83,6 +72,17 @@ module Gitlab
def
above_threshold?
real_time
>=
Metrics
.
method_call_threshold
end
def
call_measurement_enabled?
expires_at
=
MEASUREMENT_ENABLED_CACHE_EXPIRES_AT
.
value
if
expires_at
<
Time
.
now
.
to_i
if
MEASUREMENT_ENABLED_CACHE_EXPIRES_AT
.
compare_and_set
(
expires_at
,
(
Time
.
now
+
30
.
seconds
).
to_i
)
MEASUREMENT_ENABLED_CACHE
.
value
=
Feature
.
get
(
:prometheus_metrics_method_instrumentation
).
enabled?
end
end
MEASUREMENT_ENABLED_CACHE
.
value
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