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
5328584b
Commit
5328584b
authored
Jan 16, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce cardinality and convert some metrics to new scheme
parent
62ef34cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
lib/gitlab/metrics/influx_db.rb
lib/gitlab/metrics/influx_db.rb
+21
-16
lib/gitlab/metrics/subscribers/active_record.rb
lib/gitlab/metrics/subscribers/active_record.rb
+1
-1
No files found.
lib/gitlab/metrics/influx_db.rb
View file @
5328584b
module
Gitlab
module
Gitlab
module
Metrics
module
Metrics
module
InfluxDb
module
InfluxDb
include
Gitlab
::
Metrics
::
Concern
include
Gitlab
::
CurrentSettings
include
Gitlab
::
CurrentSettings
extend
self
extend
self
...
@@ -12,7 +13,7 @@ module Gitlab
...
@@ -12,7 +13,7 @@ module Gitlab
end
end
# Prometheus histogram buckets used for arbitrary code measurements
# Prometheus histogram buckets used for arbitrary code measurements
EXECUTION_MEASUREMENT_BUCKETS
=
[
0.001
,
0.0
02
,
0.005
,
0.01
,
0.025
,
0.05
,
0.1
,
0.25
,
0.5
,
1
].
freeze
EXECUTION_MEASUREMENT_BUCKETS
=
[
0.001
,
0.0
1
,
0.1
,
1
].
freeze
RAILS_ROOT
=
Rails
.
root
.
to_s
RAILS_ROOT
=
Rails
.
root
.
to_s
METRICS_ROOT
=
Rails
.
root
.
join
(
'lib'
,
'gitlab'
,
'metrics'
).
to_s
METRICS_ROOT
=
Rails
.
root
.
join
(
'lib'
,
'gitlab'
,
'metrics'
).
to_s
PATH_REGEX
=
/^
#{
RAILS_ROOT
}
\/?/
PATH_REGEX
=
/^
#{
RAILS_ROOT
}
\/?/
...
@@ -105,21 +106,25 @@ module Gitlab
...
@@ -105,21 +106,25 @@ module Gitlab
real_time
=
(
real_stop
-
real_start
)
real_time
=
(
real_stop
-
real_start
)
cpu_time
=
cpu_stop
-
cpu_start
cpu_time
=
cpu_stop
-
cpu_start
Gitlab
::
Metrics
.
histogram
(
"gitlab_
#{
name
}
_real_duration_seconds"
.
to_sym
,
real_duration_seconds
=
self
.
class
.
fetch_histogram
(
"gitlab_
#{
name
}
_real_duration_seconds"
.
to_sym
)
do
"Measure
#{
name
}
"
,
docstring
"Measure
#{
name
}
"
Transaction
::
BASE_LABELS
,
base_labels
Transaction
::
BASE_LABELS
EXECUTION_MEASUREMENT_BUCKETS
)
buckets
EXECUTION_MEASUREMENT_BUCKETS
.
observe
(
trans
.
labels
,
real_time
)
end
Gitlab
::
Metrics
.
histogram
(
"gitlab_
#{
name
}
_cpu_duration_seconds"
.
to_sym
,
real_duration_seconds
.
observe
(
trans
.
labels
,
real_time
)
"Measure
#{
name
}
"
,
Transaction
::
BASE_LABELS
,
cpu_duration_seconds
=
self
.
class
.
fetch_histogram
(
"gitlab_
#{
name
}
_cpu_duration_seconds"
.
to_sym
)
do
EXECUTION_MEASUREMENT_BUCKETS
)
docstring
"Measure
#{
name
}
"
.
observe
(
trans
.
labels
,
cpu_time
/
1000.0
)
base_labels
Transaction
::
BASE_LABELS
buckets
EXECUTION_MEASUREMENT_BUCKETS
# InfluxDB stores the _real_time time values as milliseconds
# with_feature "prometheus_metrics_measure_#{name}_cpu_duration"
trans
.
increment
(
"
#{
name
}
_real_time"
,
real_time
*
1000
,
false
)
end
trans
.
increment
(
"
#{
name
}
_cpu_time"
,
cpu_time
,
false
)
cpu_duration_seconds
.
observe
(
trans
.
labels
,
cpu_time
)
# InfluxDB stores the _real_time and _cpu_time time values as milliseconds
trans
.
increment
(
"
#{
name
}
_real_time"
,
real_time
.
in_milliseconds
,
false
)
trans
.
increment
(
"
#{
name
}
_cpu_time"
,
cpu_time
.
in_milliseconds
,
false
)
trans
.
increment
(
"
#{
name
}
_call_count"
,
1
,
false
)
trans
.
increment
(
"
#{
name
}
_call_count"
,
1
,
false
)
retval
retval
...
...
lib/gitlab/metrics/subscribers/active_record.rb
View file @
5328584b
...
@@ -25,7 +25,7 @@ module Gitlab
...
@@ -25,7 +25,7 @@ module Gitlab
:gitlab_sql_duration_seconds
,
:gitlab_sql_duration_seconds
,
'SQL time'
,
'SQL time'
,
Transaction
::
BASE_LABELS
,
Transaction
::
BASE_LABELS
,
[
0.001
,
0.0
02
,
0.005
,
0.01
,
0.02
,
0.05
,
0.1
,
0.500
,
2.0
,
10.0
]
[
0.001
,
0.0
1
,
0.1
,
10.0
]
)
)
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