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
44eedb22
Commit
44eedb22
authored
Sep 07, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add info about prometheus buckets
+ fix cpu time
parent
b4dbc306
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
lib/gitlab/metrics/influx_db.rb
lib/gitlab/metrics/influx_db.rb
+8
-5
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+1
-2
No files found.
lib/gitlab/metrics/influx_db.rb
View file @
44eedb22
...
...
@@ -11,6 +11,8 @@ module Gitlab
settings
[
:enabled
]
||
false
end
# Prometheus histogram buckets used for arbitrary code measurements
EXECUTION_MEASUREMENT_BUCKETS
=
[
0.001
,
0.002
,
0.005
,
0.01
,
0.025
,
0.05
,
0.1
,
0.25
,
0.5
,
1
].
freeze
RAILS_ROOT
=
Rails
.
root
.
to_s
METRICS_ROOT
=
Rails
.
root
.
join
(
'lib'
,
'gitlab'
,
'metrics'
).
to_s
PATH_REGEX
=
/^
#{
RAILS_ROOT
}
\/?/
...
...
@@ -99,22 +101,23 @@ module Gitlab
cpu_stop
=
System
.
cpu_time
real_stop
=
Time
.
now
.
to_f
real_time
=
(
real_stop
-
real_start
)
*
1000.0
real_time
=
(
real_stop
-
real_start
)
cpu_time
=
cpu_stop
-
cpu_start
Gitlab
::
Metrics
.
histogram
(
"gitlab_
#{
name
}
_real_duration_seconds"
.
to_sym
,
"Measure
#{
name
}
"
,
Transaction
::
BASE_LABELS
,
[
0.01
,
0.02
,
0.05
,
0.1
,
0.2
,
0.5
,
1
,
2
]
)
.
observe
(
trans
.
labels
,
real_time
/
1000.0
)
EXECUTION_MEASUREMENT_BUCKETS
)
.
observe
(
trans
.
labels
,
real_time
)
Gitlab
::
Metrics
.
histogram
(
"gitlab_
#{
name
}
_cpu_duration_seconds"
.
to_sym
,
"Measure
#{
name
}
"
,
Transaction
::
BASE_LABELS
,
[
0.01
,
0.02
,
0.05
,
0.1
,
0.2
,
0.5
,
1
,
2
]
)
EXECUTION_MEASUREMENT_BUCKETS
)
.
observe
(
trans
.
labels
,
cpu_time
/
1000.0
)
trans
.
increment
(
"
#{
name
}
_real_time"
,
real_time
,
false
)
# InfluxDB stores the _real_time time values as milliseconds
trans
.
increment
(
"
#{
name
}
_real_time"
,
real_time
*
1000
,
false
)
trans
.
increment
(
"
#{
name
}
_cpu_time"
,
cpu_time
,
false
)
trans
.
increment
(
"
#{
name
}
_call_count"
,
1
,
false
)
...
...
lib/gitlab/metrics/method_call.rb
View file @
44eedb22
...
...
@@ -46,8 +46,7 @@ module Gitlab
cpu_time
=
System
.
cpu_time
-
start_cpu
@real_time
+=
real_time
@cpu_time
+=
System
.
cpu_time
-
start_cpu
@cpu_time
+=
cpu_time
@call_count
+=
1
self
.
class
.
call_real_duration_histogram
.
observe
(
@transaction
.
labels
.
merge
(
labels
),
real_time
/
1000.0
)
...
...
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