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
aa25586a
Commit
aa25586a
authored
Sep 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add action tag to more metrics
parent
6db3151f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
7 deletions
+30
-7
lib/gitlab/metrics/subscribers/active_record.rb
lib/gitlab/metrics/subscribers/active_record.rb
+2
-2
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+28
-5
No files found.
lib/gitlab/metrics/subscribers/active_record.rb
View file @
aa25586a
...
...
@@ -9,14 +9,14 @@ module Gitlab
@metric_sql_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
:gitlab_sql_duration_seconds
,
'SQL time'
,
{},
{
action:
nil
},
[
0.001
,
0.002
,
0.005
,
0.01
,
0.02
,
0.05
,
0.1
,
0.500
,
2.0
,
10.0
]
)
end
def
sql
(
event
)
self
.
class
.
metric_sql_duration_secodnds
.
observe
({},
event
.
duration
/
1000.0
)
return
unless
current_transaction
self
.
class
.
metric_sql_duration_seconds
.
observe
({
action:
current_transaction
.
action
},
event
.
duration
/
1000.0
)
current_transaction
.
increment
(
:sql_duration
,
event
.
duration
,
false
)
current_transaction
.
increment
(
:sql_count
,
1
,
false
)
...
...
lib/gitlab/metrics/transaction.rb
View file @
aa25586a
...
...
@@ -87,7 +87,7 @@ module Gitlab
# event_name - The name of the event (e.g. "git_push").
# tags - A set of tags to attach to the event.
def
add_event
(
event_name
,
tags
=
{})
Gitlab
::
Metrics
.
counter
(
"gitlab_transaction_event_
#{
event_name
}
_total"
.
to_sym
,
"Transaction event
#{
event_name
}
"
,
tags
).
increment
({}
)
self
.
class
.
metric_event_counter
(
event_name
,
tags
).
increment
(
tags
.
merge
({
action:
action
})
)
@metrics
<<
Metric
.
new
(
EVENT_SERIES
,
{
count:
1
},
tags
,
:event
)
end
...
...
@@ -101,14 +101,12 @@ module Gitlab
end
def
increment
(
name
,
value
,
compat
=
true
)
Gitlab
::
Metrics
.
counter
(
"gitlab_transaction_
#{
name
}
_total"
.
to_sym
,
"Transaction counter
#{
name
}
"
,
{})
.
increment
({},
value
)
if
compat
self
.
class
.
metric_transaction_counter
(
name
).
increment
({
action:
action
},
value
)
if
compat
@values
[
name
]
+=
value
end
def
set
(
name
,
value
,
compat
=
true
)
Gitlab
::
Metrics
.
gauge
(
"gitlab_transaction_
#{
name
}
"
.
to_sym
,
"Transaction gauge
#{
name
}
"
,
{},
:livesum
)
.
set
({},
value
)
if
compat
self
.
class
.
metric_transaction_gauge
(
name
).
set
({
action:
action
},
value
)
if
compat
@values
[
name
]
=
value
end
...
...
@@ -144,6 +142,31 @@ module Gitlab
Metrics
.
submit_metrics
(
submit_hashes
)
end
private
def
self
.
metric_event_counter
(
event_name
,
tags
)
@metric_event_counters
||=
{}
@metric_event_counters
[
event_name
]
||=
Gitlab
::
Metrics
.
counter
(
"gitlab_transaction_event_
#{
event_name
}
_total"
.
to_sym
,
"Transaction event
#{
event_name
}
counter"
,
tags
.
merge
({
action:
nil
})
)
end
def
self
.
metric_transaction_counter
(
name
)
@metric_transaction_counters
||=
{}
@metric_transaction_counters
[
name
]
||=
Gitlab
::
Metrics
.
counter
(
"gitlab_transaction_
#{
name
}
_total"
.
to_sym
,
"Transaction
#{
name
}
counter"
,
action:
nil
)
end
def
self
.
metric_transaction_gauge
(
name
)
@metric_transaction_gauges
||=
{}
@metric_transaction_gauges
[
name
]
||=
Gitlab
::
Metrics
.
gauge
(
"gitlab_transaction_
#{
name
}
"
.
to_sym
,
"Transaction gauge
#{
name
}
"
,
{
action:
nil
},
:livesum
)
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