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
ebe204aa
Commit
ebe204aa
authored
Nov 05, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE issue activity counters to EE
These should not be in CE since these features are EE-only
parent
f8e050cf
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
57 deletions
+96
-57
app/models/resource_timebox_event.rb
app/models/resource_timebox_event.rb
+2
-2
ee/app/models/ee/resource_timebox_event.rb
ee/app/models/ee/resource_timebox_event.rb
+19
-0
ee/lib/ee/gitlab/usage_data_counters/issue_activity_unique_counter.rb
...tlab/usage_data_counters/issue_activity_unique_counter.rb
+25
-0
ee/spec/lib/ee/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
...usage_data_counters/issue_activity_unique_counter_spec.rb
+50
-0
lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb
...tlab/usage_data_counters/issue_activity_unique_counter.rb
+0
-25
spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
...usage_data_counters/issue_activity_unique_counter_spec.rb
+0
-30
No files found.
app/models/resource_timebox_event.rb
View file @
ebe204aa
...
...
@@ -29,10 +29,10 @@ class ResourceTimeboxEvent < ResourceEvent
case
self
when
ResourceMilestoneEvent
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
.
track_issue_milestone_changed_action
(
author:
user
)
when
ResourceIterationEvent
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
.
track_issue_iteration_changed_action
(
author:
user
)
else
# no-op
end
end
end
ResourceTimeboxEvent
.
prepend_if_ee
(
'EE::ResourceTimeboxEvent'
)
ee/app/models/ee/resource_timebox_event.rb
0 → 100644
View file @
ebe204aa
# frozen_string_literal: true
module
EE
module
ResourceTimeboxEvent
extend
::
Gitlab
::
Utils
::
Override
private
override
:usage_metrics
def
usage_metrics
case
self
when
ResourceIterationEvent
::
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
.
track_issue_iteration_changed_action
(
author:
user
)
else
super
end
end
end
end
ee/lib/ee/gitlab/usage_data_counters/issue_activity_unique_counter.rb
View file @
ebe204aa
...
...
@@ -7,11 +7,36 @@ module EE
extend
ActiveSupport
::
Concern
ISSUE_HEALTH_STATUS_CHANGED
=
'g_project_management_issue_health_status_changed'
ISSUE_ITERATION_CHANGED
=
'g_project_management_issue_iteration_changed'
ISSUE_WEIGHT_CHANGED
=
'g_project_management_issue_weight_changed'
ISSUE_ADDED_TO_EPIC
=
'g_project_management_issue_added_to_epic'
ISSUE_REMOVED_FROM_EPIC
=
'g_project_management_issue_removed_from_epic'
ISSUE_CHANGED_EPIC
=
'g_project_management_issue_changed_epic'
class_methods
do
def
track_issue_health_status_changed_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_HEALTH_STATUS_CHANGED
,
author
,
time
)
end
def
track_issue_iteration_changed_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_ITERATION_CHANGED
,
author
,
time
)
end
def
track_issue_weight_changed_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_WEIGHT_CHANGED
,
author
,
time
)
end
def
track_issue_added_to_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_ADDED_TO_EPIC
,
author
,
time
)
end
def
track_issue_removed_from_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_REMOVED_FROM_EPIC
,
author
,
time
)
end
def
track_issue_changed_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_CHANGED_EPIC
,
author
,
time
)
end
end
end
end
...
...
ee/spec/lib/ee/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
View file @
ebe204aa
...
...
@@ -17,4 +17,54 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
end
end
end
context
'for Issue iteration changed actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_ITERATION_CHANGED
}
def
track_action
(
params
)
described_class
.
track_issue_iteration_changed_action
(
**
params
)
end
end
end
context
'for Issue weight changed actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_WEIGHT_CHANGED
}
def
track_action
(
params
)
described_class
.
track_issue_weight_changed_action
(
**
params
)
end
end
end
context
'for Issue added to epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_ADDED_TO_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_added_to_epic_action
(
**
params
)
end
end
end
context
'for Issue removed from epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_REMOVED_FROM_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_removed_from_epic_action
(
**
params
)
end
end
end
context
'for Issue changed epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_CHANGED_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_changed_epic_action
(
**
params
)
end
end
end
end
lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb
View file @
ebe204aa
...
...
@@ -9,14 +9,12 @@ module Gitlab
ISSUE_CREATED
=
'g_project_management_issue_created'
ISSUE_CLOSED
=
'g_project_management_issue_closed'
ISSUE_DESCRIPTION_CHANGED
=
'g_project_management_issue_description_changed'
ISSUE_ITERATION_CHANGED
=
'g_project_management_issue_iteration_changed'
ISSUE_LABEL_CHANGED
=
'g_project_management_issue_label_changed'
ISSUE_MADE_CONFIDENTIAL
=
'g_project_management_issue_made_confidential'
ISSUE_MADE_VISIBLE
=
'g_project_management_issue_made_visible'
ISSUE_MILESTONE_CHANGED
=
'g_project_management_issue_milestone_changed'
ISSUE_REOPENED
=
'g_project_management_issue_reopened'
ISSUE_TITLE_CHANGED
=
'g_project_management_issue_title_changed'
ISSUE_WEIGHT_CHANGED
=
'g_project_management_issue_weight_changed'
ISSUE_CROSS_REFERENCED
=
'g_project_management_issue_cross_referenced'
ISSUE_MOVED
=
'g_project_management_issue_moved'
ISSUE_RELATED
=
'g_project_management_issue_related'
...
...
@@ -24,9 +22,6 @@ module Gitlab
ISSUE_MARKED_AS_DUPLICATE
=
'g_project_management_issue_marked_as_duplicate'
ISSUE_LOCKED
=
'g_project_management_issue_locked'
ISSUE_UNLOCKED
=
'g_project_management_issue_unlocked'
ISSUE_ADDED_TO_EPIC
=
'g_project_management_issue_added_to_epic'
ISSUE_REMOVED_FROM_EPIC
=
'g_project_management_issue_removed_from_epic'
ISSUE_CHANGED_EPIC
=
'g_project_management_issue_changed_epic'
ISSUE_DESIGNS_ADDED
=
'g_project_management_issue_designs_added'
ISSUE_DESIGNS_MODIFIED
=
'g_project_management_issue_designs_modified'
ISSUE_DESIGNS_REMOVED
=
'g_project_management_issue_designs_removed'
...
...
@@ -78,14 +73,6 @@ module Gitlab
track_unique_action
(
ISSUE_MILESTONE_CHANGED
,
author
,
time
)
end
def
track_issue_iteration_changed_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_ITERATION_CHANGED
,
author
,
time
)
end
def
track_issue_weight_changed_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_WEIGHT_CHANGED
,
author
,
time
)
end
def
track_issue_cross_referenced_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_CROSS_REFERENCED
,
author
,
time
)
end
...
...
@@ -114,18 +101,6 @@ module Gitlab
track_unique_action
(
ISSUE_UNLOCKED
,
author
,
time
)
end
def
track_issue_added_to_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_ADDED_TO_EPIC
,
author
,
time
)
end
def
track_issue_removed_from_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_REMOVED_FROM_EPIC
,
author
,
time
)
end
def
track_issue_changed_epic_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_CHANGED_EPIC
,
author
,
time
)
end
def
track_issue_designs_added_action
(
author
:,
time:
Time
.
zone
.
now
)
track_unique_action
(
ISSUE_DESIGNS_ADDED
,
author
,
time
)
end
...
...
spec/lib/gitlab/usage_data_counters/issue_activity_unique_counter_spec.rb
View file @
ebe204aa
...
...
@@ -168,36 +168,6 @@ RSpec.describe Gitlab::UsageDataCounters::IssueActivityUniqueCounter, :clean_git
end
end
context
'for Issue added to epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_ADDED_TO_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_added_to_epic_action
(
**
params
)
end
end
end
context
'for Issue removed from epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_REMOVED_FROM_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_removed_from_epic_action
(
**
params
)
end
end
end
context
'for Issue changed epic actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_CHANGED_EPIC
}
def
track_action
(
params
)
described_class
.
track_issue_changed_epic_action
(
**
params
)
end
end
end
context
'for Issue designs added actions'
do
it_behaves_like
'a tracked issue edit event'
do
let
(
:action
)
{
described_class
::
ISSUE_DESIGNS_ADDED
}
...
...
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