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
29a1ad16
Commit
29a1ad16
authored
Sep 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tune bucket sizes an action labels
parent
aa25586a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
19 deletions
+19
-19
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+4
-4
lib/gitlab/metrics/rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+8
-8
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+1
-1
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+6
-6
No files found.
lib/gitlab/metrics/method_call.rb
View file @
29a1ad16
...
...
@@ -9,7 +9,7 @@ module Gitlab
:gitlab_method_call_real_duration_seconds
,
'Method calls real duration'
,
{
action:
nil
,
call_name:
nil
},
[
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
100000
0
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
1
0
]
)
end
...
...
@@ -18,7 +18,7 @@ module Gitlab
:gitlab_method_call_cpu_duration_seconds
,
'Method calls cpu duration'
,
{
action:
nil
,
call_name:
nil
},
[
1000
,
2000
,
5000
,
10000
,
20000
,
50000
,
100000
,
100000
0
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
1
0
]
)
end
...
...
@@ -44,8 +44,8 @@ module Gitlab
@call_count
+=
1
if
above_threshold?
self
.
class
.
call_real_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@real_time
)
self
.
class
.
call_cpu_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@cpu_time
)
self
.
class
.
call_real_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@real_time
/
1000.0
)
self
.
class
.
call_cpu_duration_histogram
.
observe
({
call_name:
@name
,
action:
@action
},
@cpu_time
/
1000.0
)
end
retval
...
...
lib/gitlab/metrics/rack_middleware.rb
View file @
29a1ad16
...
...
@@ -35,12 +35,6 @@ module Gitlab
# Even in the event of an error we want to submit any metrics we
# might've gathered up to this point.
ensure
if
env
[
CONTROLLER_KEY
]
tag_controller
(
trans
,
env
)
elsif
env
[
ENDPOINT_KEY
]
tag_endpoint
(
trans
,
env
)
end
trans
.
finish
end
...
...
@@ -50,8 +44,14 @@ module Gitlab
def
transaction_from_env
(
env
)
trans
=
Transaction
.
new
trans
.
set
(
:request_uri
,
filtered_path
(
env
))
trans
.
set
(
:request_method
,
env
[
'REQUEST_METHOD'
])
trans
.
set
(
:request_uri
,
filtered_path
(
env
),
false
)
trans
.
set
(
:request_method
,
env
[
'REQUEST_METHOD'
],
false
)
if
env
[
CONTROLLER_KEY
]
tag_controller
(
trans
,
env
)
elsif
env
[
ENDPOINT_KEY
]
tag_endpoint
(
trans
,
env
)
end
trans
end
...
...
lib/gitlab/metrics/subscribers/rails_cache.rb
View file @
29a1ad16
...
...
@@ -67,7 +67,7 @@ module Gitlab
def
observe
(
key
,
duration
)
return
unless
current_transaction
metric_cache_duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.1
)
self
.
class
.
metric_cache_duration_seconds
.
observe
({
operation:
key
,
action:
action
},
duration
/
1000.0
)
current_transaction
.
increment
(
:cache_duration
,
duration
,
false
)
current_transaction
.
increment
(
:cache_count
,
1
,
false
)
current_transaction
.
increment
(
"
#{
key
}
_duration"
.
to_sym
,
duration
,
false
)
...
...
lib/gitlab/metrics/transaction.rb
View file @
29a1ad16
...
...
@@ -54,7 +54,7 @@ module Gitlab
:gitlab_transaction_allocated_memory_bytes
,
'Transaction allocated memory bytes'
,
{
action:
nil
},
[
500000
,
1000000
,
2000000
,
5000000
,
10000000
,
20000000
,
100000000
]
[
1000
,
10000
,
20000
,
500000
,
1000000
,
2000000
,
5000000
,
10000000
,
20000000
,
100000000
]
)
end
...
...
@@ -70,7 +70,7 @@ module Gitlab
@finished_at
=
System
.
monotonic_time
Transaction
.
metric_transaction_duration_seconds
.
observe
({
action:
action
},
duration
*
1000
)
Transaction
.
metric_transaction_allocated_memory_bytes
.
observe
({
action:
action
},
allocated_memory
/
2
^
2
0
)
Transaction
.
metric_transaction_allocated_memory_bytes
.
observe
({
action:
action
},
allocated_memory
*
1024.
0
)
Thread
.
current
[
THREAD_KEY
]
=
nil
end
...
...
@@ -100,13 +100,13 @@ module Gitlab
method
end
def
increment
(
name
,
value
,
compat
=
true
)
self
.
class
.
metric_transaction_counter
(
name
).
increment
({
action:
action
},
value
)
if
compat
def
increment
(
name
,
value
,
use_prometheus
=
true
)
self
.
class
.
metric_transaction_counter
(
name
).
increment
({
action:
action
},
value
)
if
use_prometheus
@values
[
name
]
+=
value
end
def
set
(
name
,
value
,
compat
=
true
)
self
.
class
.
metric_transaction_gauge
(
name
).
set
({
action:
action
},
value
)
if
compat
def
set
(
name
,
value
,
use_prometheus
=
true
)
self
.
class
.
metric_transaction_gauge
(
name
).
set
({
action:
action
},
value
)
if
use_prometheus
@values
[
name
]
=
value
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