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
9a6a06ba
Commit
9a6a06ba
authored
Jul 19, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
63696b30
32536044
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
19 deletions
+6
-19
lib/gitlab/metrics/samplers/ruby_sampler.rb
lib/gitlab/metrics/samplers/ruby_sampler.rb
+6
-19
No files found.
lib/gitlab/metrics/samplers/ruby_sampler.rb
View file @
9a6a06ba
...
...
@@ -7,7 +7,7 @@ module Gitlab
module
Samplers
class
RubySampler
<
BaseSampler
def
initialize
(
interval
)
metrics
[
:process_start_time_seconds
].
set
(
labels
.
merge
(
worker_label
)
,
Time
.
now
.
to_i
)
metrics
[
:process_start_time_seconds
].
set
(
labels
,
Time
.
now
.
to_i
)
super
end
...
...
@@ -50,9 +50,9 @@ module Gitlab
def
sample
start_time
=
System
.
monotonic_time
metrics
[
:file_descriptors
].
set
(
labels
.
merge
(
worker_label
)
,
System
.
file_descriptor_count
)
metrics
[
:process_cpu_seconds_total
].
set
(
labels
.
merge
(
worker_label
)
,
::
Gitlab
::
Metrics
::
System
.
cpu_time
)
metrics
[
:process_max_fds
].
set
(
labels
.
merge
(
worker_label
)
,
::
Gitlab
::
Metrics
::
System
.
max_open_file_descriptors
)
metrics
[
:file_descriptors
].
set
(
labels
,
System
.
file_descriptor_count
)
metrics
[
:process_cpu_seconds_total
].
set
(
labels
,
::
Gitlab
::
Metrics
::
System
.
cpu_time
)
metrics
[
:process_max_fds
].
set
(
labels
,
::
Gitlab
::
Metrics
::
System
.
max_open_file_descriptors
)
set_memory_usage_metrics
sample_gc
...
...
@@ -75,22 +75,9 @@ module Gitlab
def
set_memory_usage_metrics
memory_usage
=
System
.
memory_usage
memory_labels
=
labels
.
merge
(
worker_label
)
metrics
[
:memory_bytes
].
set
(
memory_labels
,
memory_usage
)
metrics
[
:process_resident_memory_bytes
].
set
(
memory_labels
,
memory_usage
)
end
def
worker_label
return
{
worker:
'sidekiq'
}
if
Sidekiq
.
server?
return
{}
unless
defined?
(
Unicorn
::
Worker
)
worker_no
=
::
Prometheus
::
Client
::
Support
::
Unicorn
.
worker_id
if
worker_no
{
worker:
worker_no
}
else
{
worker:
'master'
}
end
metrics
[
:memory_bytes
].
set
(
labels
,
memory_usage
)
metrics
[
:process_resident_memory_bytes
].
set
(
labels
,
memory_usage
)
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