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
bd0d49d5
Commit
bd0d49d5
authored
Apr 12, 2021
by
Felipe Artur
Committed by
Matthias Käppler
Apr 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track epic destroy event on usage ping
Record epic destroy event on usage ping
parent
99b2ae9c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
170 additions
and
5 deletions
+170
-5
app/services/issuable/destroy_service.rb
app/services/issuable/destroy_service.rb
+15
-5
doc/development/usage_ping/dictionary.md
doc/development/usage_ping/dictionary.md
+24
-0
ee/app/services/ee/issuable/destroy_service.rb
ee/app/services/ee/issuable/destroy_service.rb
+29
-0
ee/changelogs/unreleased/issue_292253-track_epic_destroyed.yml
...angelogs/unreleased/issue_292253-track_epic_destroyed.yml
+5
-0
ee/config/metrics/counts_28d/20210413174710_g_project_management_epic_destroyed_monthly.yml
...413174710_g_project_management_epic_destroyed_monthly.yml
+21
-0
ee/config/metrics/counts_7d/20210413174449_g_project_management_epic_destroyed_weekly.yml
...0413174449_g_project_management_epic_destroyed_weekly.yml
+22
-0
ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb
...itlab/usage_data_counters/epic_activity_unique_counter.rb
+5
-0
ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb
.../usage_data_counters/epic_activity_unique_counter_spec.rb
+12
-0
ee/spec/services/ee/issuable/destroy_service_spec.rb
ee/spec/services/ee/issuable/destroy_service_spec.rb
+31
-0
lib/gitlab/usage_data_counters/known_events/epic_events.yml
lib/gitlab/usage_data_counters/known_events/epic_events.yml
+6
-0
No files found.
app/services/issuable/destroy_service.rb
View file @
bd0d49d5
...
...
@@ -4,18 +4,26 @@ module Issuable
class
DestroyService
<
IssuableBaseService
def
execute
(
issuable
)
if
issuable
.
destroy
delete_todos
(
issuable
)
issuable
.
update_project_counter_caches
issuable
.
assignees
.
each
(
&
:invalidate_cache_counts
)
after_destroy
(
issuable
)
end
end
private
def
after_destroy
(
issuable
)
delete_todos
(
issuable
)
issuable
.
update_project_counter_caches
issuable
.
assignees
.
each
(
&
:invalidate_cache_counts
)
end
def
group_for
(
issuable
)
issuable
.
resource_parent
end
def
delete_todos
(
issuable
)
actor
=
issuable
.
is_a?
(
Epic
)
?
issuable
.
resource_parent
:
issuable
.
resource_parent
.
group
group
=
group_for
(
issuable
)
if
Feature
.
enabled?
(
:destroy_issuable_todos_async
,
actor
,
default_enabled: :yaml
)
if
Feature
.
enabled?
(
:destroy_issuable_todos_async
,
group
,
default_enabled: :yaml
)
TodosDestroyer
::
DestroyedIssuableWorker
.
perform_async
(
issuable
.
id
,
issuable
.
class
.
name
)
else
...
...
@@ -26,3 +34,5 @@ module Issuable
end
end
end
Issuable
::
DestroyService
.
prepend_if_ee
(
'EE::Issuable::DestroyService'
)
doc/development/usage_ping/dictionary.md
View file @
bd0d49d5
...
...
@@ -9872,6 +9872,30 @@ Status: `data_available`
Tiers:
`premium`
,
`ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_destroyed_monthly`
Count of MAU destroying epics
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_28d/20210413174710_g_project_management_epic_destroyed_monthly.yml
)
Group:
`group::product planning`
Status:
`implemented`
Tiers:
`premium`
,
`ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_destroyed_weekly`
Count of WAU destroying epics
[
YAML definition
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/config/metrics/counts_7d/20210413174449_g_project_management_epic_destroyed_weekly.yml
)
Group:
`group::product planning`
Status:
`implemented`
Tiers:
`premium`
,
`ultimate`
### `redis_hll_counters.epics_usage.g_project_management_epic_issue_added_monthly`
Count of MAU adding issues to epics
...
...
ee/app/services/ee/issuable/destroy_service.rb
0 → 100644
View file @
bd0d49d5
# frozen_string_literal: true
module
EE
module
Issuable
module
DestroyService
extend
::
Gitlab
::
Utils
::
Override
private
override
:after_destroy
def
after_destroy
(
issuable
)
track_usage_ping_epic_destroyed
if
issuable
.
is_a?
(
Epic
)
super
end
override
:group_for
def
group_for
(
issuable
)
return
issuable
.
resource_parent
if
issuable
.
is_a?
(
Epic
)
super
end
def
track_usage_ping_epic_destroyed
::
Gitlab
::
UsageDataCounters
::
EpicActivityUniqueCounter
.
track_epic_destroyed
(
author:
current_user
)
end
end
end
end
ee/changelogs/unreleased/issue_292253-track_epic_destroyed.yml
0 → 100644
View file @
bd0d49d5
---
title
:
Track epic destroyed action on usage ping
merge_request
:
59185
author
:
type
:
other
ee/config/metrics/counts_28d/20210413174710_g_project_management_epic_destroyed_monthly.yml
0 → 100644
View file @
bd0d49d5
---
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path
:
redis_hll_counters.epics_usage.g_project_management_epic_destroyed_monthly
description
:
Count of MAU destroying epics
product_section
:
dev
product_stage
:
plan
product_group
:
group::product planning
product_category
:
epics_usage
value_type
:
number
status
:
implemented
milestone
:
"
13.11"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59185
time_frame
:
28d
data_source
:
redis_hll
distribution
:
-
ee
tier
:
-
premium
-
ultimate
ee/config/metrics/counts_7d/20210413174449_g_project_management_epic_destroyed_weekly.yml
0 → 100644
View file @
bd0d49d5
---
# Name of this metric contains g_project_management prefix
# because we are using the same slot from issue_tracking to
# allow data aggregation.
key_path
:
redis_hll_counters.epics_usage.g_project_management_epic_destroyed_weekly
description
:
Count of WAU destroying epics
product_section
:
dev
product_stage
:
plan
product_group
:
group::product planning
product_category
:
epics_usage
value_type
:
number
status
:
implemented
milestone
:
"
13.11"
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59185
time_frame
:
7d
data_source
:
redis_hll
distribution
:
-
ee
tier
:
-
premium
-
ultimate
ee/lib/gitlab/usage_data_counters/epic_activity_unique_counter.rb
View file @
bd0d49d5
...
...
@@ -28,6 +28,7 @@ module Gitlab
EPIC_CONFIDENTIAL
=
'g_project_management_users_setting_epic_confidential'
EPIC_VISIBLE
=
'g_project_management_users_setting_epic_visible'
EPIC_LABELS
=
'g_project_management_epic_users_changing_labels'
EPIC_DESTROYED
=
'g_project_management_epic_destroyed'
class
<<
self
def
track_epic_created_action
(
author
:)
...
...
@@ -114,6 +115,10 @@ module Gitlab
track_unique_action
(
EPIC_LABELS
,
author
)
end
def
track_epic_destroyed
(
author
:)
track_unique_action
(
EPIC_DESTROYED
,
author
)
end
private
def
track_unique_action
(
action
,
author
)
...
...
ee/spec/lib/gitlab/usage_data_counters/epic_activity_unique_counter_spec.rb
View file @
bd0d49d5
...
...
@@ -257,4 +257,16 @@ RSpec.describe Gitlab::UsageDataCounters::EpicActivityUniqueCounter, :clean_gitl
it_behaves_like
'does not track when feature flag is disabled'
,
:track_epics_activity
end
context
'for destroying epic'
do
def
track_action
(
params
)
described_class
.
track_epic_destroyed
(
**
params
)
end
it_behaves_like
'a daily tracked issuable event'
do
let
(
:action
)
{
described_class
::
ISSUE_EPIC_DESTROYED
}
end
it_behaves_like
'does not track when feature flag is disabled'
,
:track_epics_activity
end
end
ee/spec/services/ee/issuable/destroy_service_spec.rb
0 → 100644
View file @
bd0d49d5
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Issuable
::
DestroyService
do
let_it_be
(
:user
)
{
create
(
:user
)
}
subject
(
:service
)
{
described_class
.
new
(
nil
,
user
)
}
describe
'#execute'
do
context
'when destroying an epic'
do
let
(
:issuable
)
{
create
(
:epic
)
}
it
'records usage ping epic destroy event'
do
expect
(
Gitlab
::
UsageDataCounters
::
EpicActivityUniqueCounter
).
to
receive
(
:track_epic_destroyed
).
with
(
author:
user
)
subject
.
execute
(
issuable
)
end
end
context
'when destroying other issuable type'
do
let
(
:issuable
)
{
create
(
:issue
)
}
it
'does not track usage ping epic destroy event'
do
expect
(
Gitlab
::
UsageDataCounters
::
EpicActivityUniqueCounter
).
not_to
receive
(
:track_epic_destroyed
)
subject
.
execute
(
issuable
)
end
end
end
end
lib/gitlab/usage_data_counters/known_events/epic_events.yml
View file @
bd0d49d5
...
...
@@ -134,3 +134,9 @@
redis_slot
:
project_management
aggregation
:
daily
feature_flag
:
track_epics_activity
-
name
:
g_project_management_epic_destroyed
category
:
epics_usage
redis_slot
:
project_management
aggregation
:
daily
feature_flag
:
track_epics_activity
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