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
2a209c23
Commit
2a209c23
authored
Feb 11, 2022
by
Mario Celi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track users updating work item titles
Implement service ping for event users_updating_work_item_title
parent
a7cded48
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
149 additions
and
1 deletion
+149
-1
app/services/system_notes/issuables_service.rb
app/services/system_notes/issuables_service.rb
+5
-0
config/feature_flags/development/track_work_items_activity.yml
...g/feature_flags/development/track_work_items_activity.yml
+8
-0
config/metrics/counts_28d/20220214202927_users_updating_work_item_title.yml
...nts_28d/20220214202927_users_updating_work_item_title.yml
+25
-0
config/metrics/counts_7d/20220216204730_users_updating_work_item_title_weekly.yml
.../20220216204730_users_updating_work_item_title_weekly.yml
+25
-0
lib/gitlab/usage_data_counters/known_events/work_items.yml
lib/gitlab/usage_data_counters/known_events/work_items.yml
+6
-0
lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb
.../usage_data_counters/work_item_activity_unique_counter.rb
+23
-0
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
.../lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
+2
-1
spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb
...e_data_counters/work_item_activity_unique_counter_spec.rb
+51
-0
spec/services/work_items/update_service_spec.rb
spec/services/work_items/update_service_spec.rb
+4
-0
No files found.
app/services/system_notes/issuables_service.rb
View file @
2a209c23
...
@@ -160,6 +160,7 @@ module SystemNotes
...
@@ -160,6 +160,7 @@ module SystemNotes
body
=
"changed title from **
#{
marked_old_title
}
** to **
#{
marked_new_title
}
**"
body
=
"changed title from **
#{
marked_old_title
}
** to **
#{
marked_new_title
}
**"
issue_activity_counter
.
track_issue_title_changed_action
(
author:
author
)
if
noteable
.
is_a?
(
Issue
)
issue_activity_counter
.
track_issue_title_changed_action
(
author:
author
)
if
noteable
.
is_a?
(
Issue
)
work_item_activity_counter
.
track_work_item_title_changed_action
(
author:
author
)
if
noteable
.
is_a?
(
WorkItem
)
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'title'
))
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'title'
))
end
end
...
@@ -484,6 +485,10 @@ module SystemNotes
...
@@ -484,6 +485,10 @@ module SystemNotes
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
end
end
def
work_item_activity_counter
Gitlab
::
UsageDataCounters
::
WorkItemActivityUniqueCounter
end
def
track_cross_reference_action
def
track_cross_reference_action
issue_activity_counter
.
track_issue_cross_referenced_action
(
author:
author
)
if
noteable
.
is_a?
(
Issue
)
issue_activity_counter
.
track_issue_cross_referenced_action
(
author:
author
)
if
noteable
.
is_a?
(
Issue
)
end
end
...
...
config/feature_flags/development/track_work_items_activity.yml
0 → 100644
View file @
2a209c23
---
name
:
track_work_items_activity
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80532
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/352903
milestone
:
'
14.9'
type
:
development
group
:
group::project management
default_enabled
:
false
config/metrics/counts_28d/20220214202927_users_updating_work_item_title.yml
0 → 100644
View file @
2a209c23
---
key_path
:
redis_hll_counters.work_items.users_updating_work_item_title_monthly
description
:
Unique users updating a work item's title
product_category
:
team planning
product_section
:
dev
product_stage
:
plan
product_group
:
group::project management
value_type
:
number
status
:
active
milestone
:
'
14.9'
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80532
time_frame
:
28d
data_source
:
redis_hll
data_category
:
optional
instrumentation_class
:
RedisHLLMetric
options
:
events
:
-
users_updating_work_item_title
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/counts_7d/20220216204730_users_updating_work_item_title_weekly.yml
0 → 100644
View file @
2a209c23
---
key_path
:
redis_hll_counters.work_items.users_updating_work_item_title_weekly
description
:
Unique users updating a work item's title
product_category
:
team planning
product_section
:
dev
product_stage
:
plan
product_group
:
group::project management
value_type
:
number
status
:
active
milestone
:
'
14.9'
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/80532
time_frame
:
7d
data_source
:
redis_hll
data_category
:
optional
instrumentation_class
:
RedisHLLMetric
options
:
events
:
-
users_updating_work_item_title
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
lib/gitlab/usage_data_counters/known_events/work_items.yml
0 → 100644
View file @
2a209c23
---
-
name
:
users_updating_work_item_title
category
:
work_items
redis_slot
:
users
aggregation
:
weekly
feature_flag
:
track_work_items_activity
lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb
0 → 100644
View file @
2a209c23
# frozen_string_literal: true
module
Gitlab
module
UsageDataCounters
module
WorkItemActivityUniqueCounter
WORK_ITEM_TITLE_CHANGED
=
'users_updating_work_item_title'
class
<<
self
def
track_work_item_title_changed_action
(
author
:)
track_unique_action
(
WORK_ITEM_TITLE_CHANGED
,
author
)
end
private
def
track_unique_action
(
action
,
author
)
return
unless
author
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
track_event
(
action
,
values:
author
.
id
)
end
end
end
end
end
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb
View file @
2a209c23
...
@@ -50,7 +50,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
...
@@ -50,7 +50,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
'importer'
,
'importer'
,
'network_policies'
,
'network_policies'
,
'geo'
,
'geo'
,
'growth'
'growth'
,
'work_items'
)
)
end
end
end
end
...
...
spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb
0 → 100644
View file @
2a209c23
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
UsageDataCounters
::
WorkItemActivityUniqueCounter
,
:clean_gitlab_redis_shared_state
do
let
(
:user
)
{
build
(
:user
,
id:
1
)
}
shared_examples
'counter that does not track the event'
do
it
'does not track the event'
do
expect
{
3
.
times
{
track_event
}
}.
to
not_change
{
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
unique_events
(
event_names:
event_name
,
start_date:
2
.
weeks
.
ago
,
end_date:
2
.
weeks
.
from_now
)
}
end
end
describe
'.track_work_item_title_changed_action'
do
subject
(
:track_event
)
{
described_class
.
track_work_item_title_changed_action
(
author:
user
)
}
let
(
:event_name
)
{
described_class
::
WORK_ITEM_TITLE_CHANGED
}
context
'when track_work_items_activity FF is enabled'
do
it
'tracks a unique event only once'
do
expect
{
3
.
times
{
track_event
}
}.
to
change
{
Gitlab
::
UsageDataCounters
::
HLLRedisCounter
.
unique_events
(
event_names:
described_class
::
WORK_ITEM_TITLE_CHANGED
,
start_date:
2
.
weeks
.
ago
,
end_date:
2
.
weeks
.
from_now
)
}.
by
(
1
)
end
context
'when author is nil'
do
let
(
:user
)
{
nil
}
it_behaves_like
'counter that does not track the event'
end
end
context
'when track_work_items_activity FF is disabled'
do
before
do
stub_feature_flags
(
track_work_items_activity:
false
)
end
it_behaves_like
'counter that does not track the event'
end
end
end
spec/services/work_items/update_service_spec.rb
View file @
2a209c23
...
@@ -23,6 +23,9 @@ RSpec.describe WorkItems::UpdateService do
...
@@ -23,6 +23,9 @@ RSpec.describe WorkItems::UpdateService do
it
'triggers issuable_title_updated graphql subscription'
do
it
'triggers issuable_title_updated graphql subscription'
do
expect
(
GraphqlTriggers
).
to
receive
(
:issuable_title_updated
).
with
(
work_item
).
and_call_original
expect
(
GraphqlTriggers
).
to
receive
(
:issuable_title_updated
).
with
(
work_item
).
and_call_original
expect
(
Gitlab
::
UsageDataCounters
::
WorkItemActivityUniqueCounter
).
to
receive
(
:track_work_item_title_changed_action
).
with
(
author:
current_user
)
# During the work item transition we also want to track work items as issues
expect
(
Gitlab
::
UsageDataCounters
::
IssueActivityUniqueCounter
).
to
receive
(
:track_issue_title_changed_action
)
update_work_item
update_work_item
end
end
...
@@ -33,6 +36,7 @@ RSpec.describe WorkItems::UpdateService do
...
@@ -33,6 +36,7 @@ RSpec.describe WorkItems::UpdateService do
it
'does not trigger issuable_title_updated graphql subscription'
do
it
'does not trigger issuable_title_updated graphql subscription'
do
expect
(
GraphqlTriggers
).
not_to
receive
(
:issuable_title_updated
)
expect
(
GraphqlTriggers
).
not_to
receive
(
:issuable_title_updated
)
expect
(
Gitlab
::
UsageDataCounters
::
WorkItemActivityUniqueCounter
).
not_to
receive
(
:track_work_item_title_changed_action
)
update_work_item
update_work_item
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