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
50c9ba43
Commit
50c9ba43
authored
Feb 20, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only use features for events
parent
93c0a168
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+3
-3
No files found.
lib/gitlab/metrics/transaction.rb
View file @
50c9ba43
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
# event_name - The name of the event (e.g. "git_push").
# event_name - The name of the event (e.g. "git_push").
# tags - A set of tags to attach to the event.
# tags - A set of tags to attach to the event.
def
add_event
(
event_name
,
tags
=
{})
def
add_event
(
event_name
,
tags
=
{})
self
.
class
.
transaction_metric
(
event_name
,
:counter
,
prefix:
'event_'
,
tags:
tags
).
increment
(
tags
.
merge
(
labels
))
self
.
class
.
transaction_metric
(
event_name
,
:counter
,
prefix:
'event_'
,
use_feature_flag:
true
,
tags:
tags
).
increment
(
tags
.
merge
(
labels
))
@metrics
<<
Metric
.
new
(
EVENT_SERIES
,
{
count:
1
},
tags
.
merge
(
event:
event_name
),
:event
)
@metrics
<<
Metric
.
new
(
EVENT_SERIES
,
{
count:
1
},
tags
.
merge
(
event:
event_name
),
:event
)
end
end
...
@@ -150,12 +150,12 @@ module Gitlab
...
@@ -150,12 +150,12 @@ module Gitlab
with_feature
:prometheus_metrics_transaction_allocated_memory
with_feature
:prometheus_metrics_transaction_allocated_memory
end
end
def
self
.
transaction_metric
(
name
,
type
,
prefix:
nil
,
tags:
{})
def
self
.
transaction_metric
(
name
,
type
,
prefix:
nil
,
use_feature_flag:
false
,
tags:
{})
metric_name
=
"gitlab_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
metric_name
=
"gitlab_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
fetch_metric
(
type
,
metric_name
)
do
fetch_metric
(
type
,
metric_name
)
do
docstring
"Transaction
#{
prefix
}#{
name
}
#{
type
}
"
docstring
"Transaction
#{
prefix
}#{
name
}
#{
type
}
"
base_labels
tags
.
merge
(
BASE_LABELS
)
base_labels
tags
.
merge
(
BASE_LABELS
)
with_feature
"prometheus_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
with_feature
"prometheus_transaction_
#{
prefix
}#{
name
}
_total"
.
to_sym
if
use_feature_flag
if
type
==
:gauge
if
type
==
:gauge
multiprocess_mode
:livesum
multiprocess_mode
:livesum
...
...
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