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
cfe0859a
Commit
cfe0859a
authored
Nov 23, 2020
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metrics for Clone quick_action
Usage metrics for the new clone issue quickaction
parent
2d7d9ef3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
0 deletions
+51
-0
app/services/system_notes/issuables_service.rb
app/services/system_notes/issuables_service.rb
+2
-0
changelogs/unreleased/9421-clone-quickaction-metrics.yml
changelogs/unreleased/9421-clone-quickaction-metrics.yml
+5
-0
lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb
...tlab/usage_data_counters/issue_activity_unique_counter.rb
+5
-0
lib/gitlab/usage_data_counters/known_events/common.yml
lib/gitlab/usage_data_counters/known_events/common.yml
+5
-0
spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
...usage_data_counters/issue_activity_unique_counter_spec.rb
+10
-0
spec/services/system_notes/issuables_service_spec.rb
spec/services/system_notes/issuables_service_spec.rb
+24
-0
No files found.
app/services/system_notes/issuables_service.rb
View file @
cfe0859a
...
@@ -260,6 +260,8 @@ module SystemNotes
...
@@ -260,6 +260,8 @@ module SystemNotes
cross_reference
=
noteable_ref
.
to_reference
(
project
)
cross_reference
=
noteable_ref
.
to_reference
(
project
)
body
=
"cloned
#{
direction
}
#{
cross_reference
}
"
body
=
"cloned
#{
direction
}
#{
cross_reference
}
"
issue_activity_counter
.
track_issue_cloned_action
(
author:
author
)
if
noteable
.
is_a?
(
Issue
)
&&
direction
==
:to
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'cloned'
))
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'cloned'
))
end
end
...
...
changelogs/unreleased/9421-clone-quickaction-metrics.yml
0 → 100644
View file @
cfe0859a
---
title
:
Add usage metrics for issue clone
merge_request
:
48537
author
:
type
:
added
lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb
View file @
cfe0859a
...
@@ -18,6 +18,7 @@ module Gitlab
...
@@ -18,6 +18,7 @@ module Gitlab
ISSUE_CROSS_REFERENCED
=
'g_project_management_issue_cross_referenced'
ISSUE_CROSS_REFERENCED
=
'g_project_management_issue_cross_referenced'
ISSUE_MOVED
=
'g_project_management_issue_moved'
ISSUE_MOVED
=
'g_project_management_issue_moved'
ISSUE_RELATED
=
'g_project_management_issue_related'
ISSUE_RELATED
=
'g_project_management_issue_related'
ISSUE_CLONED
=
'g_project_management_issue_cloned'
ISSUE_UNRELATED
=
'g_project_management_issue_unrelated'
ISSUE_UNRELATED
=
'g_project_management_issue_unrelated'
ISSUE_MARKED_AS_DUPLICATE
=
'g_project_management_issue_marked_as_duplicate'
ISSUE_MARKED_AS_DUPLICATE
=
'g_project_management_issue_marked_as_duplicate'
ISSUE_LOCKED
=
'g_project_management_issue_locked'
ISSUE_LOCKED
=
'g_project_management_issue_locked'
...
@@ -137,6 +138,10 @@ module Gitlab
...
@@ -137,6 +138,10 @@ module Gitlab
track_unique_action
(
ISSUE_COMMENT_REMOVED
,
author
,
time
)
track_unique_action
(
ISSUE_COMMENT_REMOVED
,
author
,
time
)
end
end
def
track_issue_cloned_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_CLONED
,
author
,
time
)
end
private
private
def
track_unique_action
(
action
,
author
,
time
)
def
track_unique_action
(
action
,
author
,
time
)
...
...
lib/gitlab/usage_data_counters/known_events/common.yml
View file @
cfe0859a
...
@@ -408,6 +408,11 @@
...
@@ -408,6 +408,11 @@
redis_slot
:
project_management
redis_slot
:
project_management
aggregation
:
daily
aggregation
:
daily
feature_flag
:
track_issue_activity_actions
feature_flag
:
track_issue_activity_actions
-
name
:
g_project_management_issue_cloned
category
:
issues_edit
redis_slot
:
project_management
aggregation
:
daily
feature_flag
:
track_issue_activity_actions
# Secrets Management
# Secrets Management
-
name
:
i_ci_secrets_management_vault_build_created
-
name
:
i_ci_secrets_management_vault_build_created
category
:
ci_secrets_management
category
:
ci_secrets_management
...
...
spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
View file @
cfe0859a
...
@@ -118,6 +118,16 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
...
@@ -118,6 +118,16 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
end
end
end
end
context
'for Issue cloned actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_CLONED
}
def
track_action
(
params
)
described_class
.
track_issue_cloned_action
(
**
params
)
end
end
end
context
'for Issue relate actions'
do
context
'for Issue relate actions'
do
it_behaves_like
'a tracked issue edit event'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_RELATED
}
let
(
:action
)
{
described_class
::
ISSUE_RELATED
}
...
...
spec/services/system_notes/issuables_service_spec.rb
View file @
cfe0859a
...
@@ -581,6 +581,30 @@ RSpec.describe ::SystemNotes::IssuablesService do
...
@@ -581,6 +581,30 @@ RSpec.describe ::SystemNotes::IssuablesService do
expect
{
subject
}.
to
raise_error
StandardError
,
/Invalid direction/
expect
{
subject
}.
to
raise_error
StandardError
,
/Invalid direction/
end
end
end
end
context
'metrics'
do
context
'cloned from'
do
let
(
:direction
)
{
:from
}
it
'does not tracks usage'
do
expect
(
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
)
.
not_to
receive
(
:track_issue_cloned_action
).
with
(
author:
author
)
subject
end
end
context
'cloned to'
do
let
(
:direction
)
{
:to
}
it
'tracks usage'
do
expect
(
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
)
.
to
receive
(
:track_issue_cloned_action
).
with
(
author:
author
)
subject
end
end
end
end
end
describe
'#mark_duplicate_issue'
do
describe
'#mark_duplicate_issue'
do
...
...
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