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
Léo-Paul Géneau
gitlab-ce
Commits
938d9ffe
Commit
938d9ffe
authored
7 years ago
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor metrics to use metrics dsl notation
parent
7d716cc8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
20 deletions
+24
-20
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+6
-5
lib/gitlab/metrics/subscribers/action_view.rb
lib/gitlab/metrics/subscribers/action_view.rb
+6
-5
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+12
-10
No files found.
lib/gitlab/metrics/method_call.rb
View file @
938d9ffe
...
@@ -8,11 +8,12 @@ module Gitlab
...
@@ -8,11 +8,12 @@ module Gitlab
BASE_LABELS
=
{
module:
nil
,
method:
nil
}.
freeze
BASE_LABELS
=
{
module:
nil
,
method:
nil
}.
freeze
attr_reader
:real_time
,
:cpu_time
,
:call_count
,
:labels
attr_reader
:real_time
,
:cpu_time
,
:call_count
,
:labels
define_histogram
:gitlab_method_call_duration_seconds
,
define_histogram
:gitlab_method_call_duration_seconds
do
docstring:
'Method calls real duration'
,
docstring
'Method calls real duration'
base_labels:
Transaction
::
BASE_LABELS
.
merge
(
BASE_LABELS
),
base_labels
Transaction
::
BASE_LABELS
.
merge
(
BASE_LABELS
)
buckets:
[
0.01
,
0.05
,
0.1
,
0.5
,
1
],
buckets
[
0.01
,
0.05
,
0.1
,
0.5
,
1
]
with_feature: :prometheus_metrics_method_instrumentation
with_feature
:prometheus_metrics_method_instrumentation
end
# name - The full name of the method (including namespace) such as
# name - The full name of the method (including namespace) such as
# `User#sign_in`.
# `User#sign_in`.
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/metrics/subscribers/action_view.rb
View file @
938d9ffe
...
@@ -4,11 +4,12 @@ module Gitlab
...
@@ -4,11 +4,12 @@ module Gitlab
# Class for tracking the rendering timings of views.
# Class for tracking the rendering timings of views.
class
ActionView
<
ActiveSupport
::
Subscriber
class
ActionView
<
ActiveSupport
::
Subscriber
include
Gitlab
::
Metrics
::
Concern
include
Gitlab
::
Metrics
::
Concern
define_histogram
:gitlab_view_rendering_duration_seconds
,
define_histogram
:gitlab_view_rendering_duration_seconds
do
docstring:
'View rendering time'
,
docstring
'View rendering time'
base_labels:
Transaction
::
BASE_LABELS
.
merge
({
path:
nil
}),
base_labels
Transaction
::
BASE_LABELS
.
merge
({
path:
nil
})
buckets:
[
0.001
,
0.01
,
0.1
,
10.0
],
buckets
[
0.001
,
0.01
,
0.1
,
10.0
]
with_feature: :prometheus_metrics_view_instrumentation
with_feature
:prometheus_metrics_view_instrumentation
end
attach_to
:action_view
attach_to
:action_view
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/metrics/transaction.rb
View file @
938d9ffe
...
@@ -137,16 +137,18 @@ module Gitlab
...
@@ -137,16 +137,18 @@ module Gitlab
"
#{
labels
[
:controller
]
}
#
#{
labels
[
:action
]
}
"
if
labels
&&
!
labels
.
empty?
"
#{
labels
[
:controller
]
}
#
#{
labels
[
:action
]
}
"
if
labels
&&
!
labels
.
empty?
end
end
define_histogram
:gitlab_transaction_duration_seconds
,
define_histogram
:gitlab_transaction_duration_seconds
do
docstring:
'Transaction duration'
,
docstring
'Transaction duration'
base_labels:
BASE_LABELS
,
base_labels
BASE_LABELS
buckets:
[
0.001
,
0.01
,
0.1
,
0.5
,
10.0
]
buckets
[
0.001
,
0.01
,
0.1
,
0.5
,
10.0
]
end
define_histogram
:gitlab_transaction_allocated_memory_bytes
,
docstring:
'Transaction allocated memory bytes'
,
define_histogram
:gitlab_transaction_allocated_memory_bytes
do
base_labels:
BASE_LABELS
,
docstring
'Transaction allocated memory bytes'
buckets:
[
100
,
1000
,
10000
,
100000
,
1000000
,
10000000
],
base_labels
BASE_LABELS
with_feature: :prometheus_metrics_transaction_allocated_memory
buckets
[
100
,
1000
,
10000
,
100000
,
1000000
,
10000000
]
with_feature
:prometheus_metrics_transaction_allocated_memory
end
def
self
.
transaction_metric
(
name
,
type
,
prefix:
nil
,
tags:
{})
def
self
.
transaction_metric
(
name
,
type
,
prefix:
nil
,
tags:
{})
metric_name
=
"gitlab_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
metric_name
=
"gitlab_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
...
...
This diff is collapsed.
Click to expand it.
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