Commit 2f429887 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 41e0294d fdd90a25
......@@ -75,7 +75,7 @@
services:
- name: postgres:11.6
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:4.0-alpine
- name: redis:5.0-alpine
variables:
POSTGRES_HOST_AUTH_METHOD: trust
......@@ -84,7 +84,7 @@
services:
- name: postgres:12
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:4.0-alpine
- name: redis:5.0-alpine
variables:
POSTGRES_HOST_AUTH_METHOD: trust
......@@ -93,7 +93,7 @@
services:
- name: postgres:11.6
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:4.0-alpine
- name: redis:5.0-alpine
- name: elasticsearch:7.9.2
command: ["elasticsearch", "-E", "discovery.type=single-node"]
variables:
......@@ -104,7 +104,7 @@
services:
- name: postgres:12
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:4.0-alpine
- name: redis:5.0-alpine
- name: elasticsearch:7.9.2
command: ["elasticsearch", "-E", "discovery.type=single-node"]
variables:
......
......@@ -199,7 +199,7 @@ export default {
:key="strategy.id"
data-testid="strategy-badge"
variant="info"
class="gl-mr-3 gl-mt-2"
class="gl-mr-3 gl-mt-2 gl-white-space-normal gl-text-left gl-px-5"
>{{ strategyBadgeText(strategy) }}</gl-badge
>
</template>
......
......@@ -109,6 +109,9 @@ module MergeRequests
create_assignee_note(merge_request, old_assignees)
notification_service.async.reassigned_merge_request(merge_request, current_user, old_assignees)
todo_service.reassigned_assignable(merge_request, current_user, old_assignees)
new_assignees = merge_request.assignees - old_assignees
merge_request_activity_counter.track_users_assigned_to_mr(users: new_assignees)
end
def handle_reviewers_change(merge_request, old_reviewers)
......@@ -117,6 +120,9 @@ module MergeRequests
notification_service.async.changed_reviewer_of_merge_request(merge_request, current_user, old_reviewers)
todo_service.reassigned_reviewable(merge_request, current_user, old_reviewers)
invalidate_cache_counts(merge_request, users: affected_reviewers.compact)
new_reviewers = merge_request.reviewers - old_reviewers
merge_request_activity_counter.track_users_review_requested(users: new_reviewers)
end
def create_branch_change_note(issuable, branch_type, old_branch, new_branch)
......
---
title: Track the number of users who are assigned and get requested for reviews
merge_request: 52194
author:
type: other
---
title: Allow Environment Scopes to Wrap on Feature Flags Table
merge_request: 52617
author:
type: fixed
---
name: usage_data_i_code_review_user_assigned
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52194
rollout_issue_url:
milestone: '13.9'
type: development
group: group::code review
default_enabled: true
---
name: usage_data_i_code_review_user_review_requested
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/52194
rollout_issue_url:
milestone: '13.9'
type: development
group: group::code review
default_enabled: true
......@@ -196,8 +196,8 @@ You can create [collapsible sections in job logs](#expand-and-collapse-job-log-s
by manually outputting special codes
that GitLab uses to determine what sections to collapse:
- Section start marker: `section_start:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K` + `TEXT_OF_SECTION_HEADER`
- Section end marker: `section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
- Section start marker: `\e[0Ksection_start:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K` + `TEXT_OF_SECTION_HEADER`
- Section end marker: `\e[0Ksection_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
You must add these codes to the script section of the CI configuration. For example,
using `echo`:
......@@ -205,9 +205,9 @@ using `echo`:
```yaml
job1:
script:
- echo -e "section_start:`date +%s`:my_first_section\r\e[0KHeader of the 1st collapsible section"
- echo -e "\e[0Ksection_start:`date +%s`:my_first_section\r\e[0KHeader of the 1st collapsible section"
- echo 'this line should be hidden when collapsed'
- echo -e "section_end:`date +%s`:my_first_section\r\e[0K"
- echo -e "\e[0Ksection_end:`date +%s`:my_first_section\r\e[0K"
```
In the example above:
......@@ -223,9 +223,9 @@ In the example above:
Sample raw job log:
```plaintext
section_start:1560896352:my_first_section\r\e[0KHeader of the 1st collapsible section
\e[0Ksection_start:1560896352:my_first_section\r\e[0KHeader of the 1st collapsible section
this line should be hidden when collapsed
section_end:1560896353:my_first_section\r\e[0K
\e[0Ksection_end:1560896353:my_first_section\r\e[0K
```
### Pre-collapse sections
......@@ -236,7 +236,7 @@ You can make the job log automatically collapse collapsible sections by adding t
Add `[collapsed=true]` after the section name and before the `\r`. The section end marker
remains unchanged:
- Section start marker with `[collapsed=true]`: `section_start:UNIX_TIMESTAMP:SECTION_NAME[collapsed=true]\r\e[0K` + `TEXT_OF_SECTION_HEADER`
- Section start marker with `[collapsed=true]`: `\e[0Ksection_start:UNIX_TIMESTAMP:SECTION_NAME[collapsed=true]\r\e[0K` + `TEXT_OF_SECTION_HEADER`
- Section end marker: `section_end:UNIX_TIMESTAMP:SECTION_NAME\r\e[0K`
Add the updated section start text to the CI configuration. For example,
......@@ -245,7 +245,7 @@ using `echo`:
```yaml
job1:
script:
- echo -e "section_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KHeader of the 1st collapsible section"
- echo -e "\e[0Ksection_start:`date +%s`:my_first_section[collapsed=true]\r\e[0KHeader of the 1st collapsible section"
- echo 'this line should be hidden automatically after loading the job log'
- echo -e "section_end:`date +%s`:my_first_section\r\e[0K"
- echo -e "\e[0Ksection_end:`date +%s`:my_first_section\r\e[0K"
```
......@@ -330,5 +330,25 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
update_merge_request(title: 'Title')
end
context 'updating assignee_ids' do
it 'updates the tracking when user ids are valid' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_users_assigned_to_mr)
.with(users: [user, user2])
update_merge_request(assignee_ids: [user.id, user2.id])
end
end
context 'updating reviewers_ids' do
it 'updates the tracking when user ids are valid' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_users_review_requested)
.with(users: [user, user2])
update_merge_request(reviewer_ids: [user.id, user2.id])
end
end
end
end
......@@ -541,6 +541,16 @@
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_apply_suggestion
- name: i_code_review_user_assigned
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_assigned
- name: i_code_review_user_review_requested
redis_slot: code_review
category: code_review
aggregation: weekly
feature_flag: usage_data_i_code_review_user_review_requested
# Terraform
- name: p_terraform_state_api_unique_users
category: terraform
......
......@@ -22,6 +22,8 @@ module Gitlab
MR_APPLY_SUGGESTION_ACTION = 'i_code_review_user_apply_suggestion'
MR_RESOLVE_THREAD_ACTION = 'i_code_review_user_resolve_thread'
MR_UNRESOLVE_THREAD_ACTION = 'i_code_review_user_unresolve_thread'
MR_ASSIGNED_USERS_ACTION = 'i_code_review_user_assigned'
MR_REVIEW_REQUESTED_USERS_ACTION = 'i_code_review_user_review_requested'
class << self
def track_mr_diffs_action(merge_request:)
......@@ -88,6 +90,14 @@ module Gitlab
track_unique_action_by_user(MR_APPLY_SUGGESTION_ACTION, user)
end
def track_users_assigned_to_mr(users:)
track_unique_action_by_users(MR_ASSIGNED_USERS_ACTION, users)
end
def track_users_review_requested(users:)
track_unique_action_by_users(MR_REVIEW_REQUESTED_USERS_ACTION, users)
end
private
def track_unique_action_by_merge_request(action, merge_request)
......@@ -100,6 +110,12 @@ module Gitlab
track_unique_action(action, user.id)
end
def track_unique_action_by_users(action, users)
return if users.blank?
track_unique_action(action, users.map(&:id))
end
def track_unique_action(action, value)
Gitlab::UsageDataCounters::HLLRedisCounter.track_usage_event(action, value)
end
......
......@@ -180,4 +180,20 @@ RSpec.describe Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter, :cl
let(:action) { described_class::MR_APPLY_SUGGESTION_ACTION }
end
end
describe '.track_users_assigned_to_mr' do
subject { described_class.track_users_assigned_to_mr(users: [user]) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_ASSIGNED_USERS_ACTION }
end
end
describe '.track_users_review_requested' do
subject { described_class.track_users_review_requested(users: [user]) }
it_behaves_like 'a tracked merge request unique event' do
let(:action) { described_class::MR_REVIEW_REQUESTED_USERS_ACTION }
end
end
end
......@@ -143,7 +143,7 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
let(:opts) { { reviewer_ids: [user2.id] } }
context 'when merge_request_reviewers feature is disabled' do
before(:context) do
before do
stub_feature_flags(merge_request_reviewers: false)
end
......@@ -152,6 +152,13 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect(note).to be_nil
end
it 'does not update the tracking' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.not_to receive(:track_users_review_requested)
update_merge_request(reviewer_ids: [user.id])
end
end
context 'when merge_request_reviewers feature is enabled' do
......@@ -165,6 +172,14 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect(note).not_to be_nil
expect(note.note).to include "requested review from #{user2.to_reference}"
end
it 'updates the tracking' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_users_review_requested)
.with(users: [user])
update_merge_request(reviewer_ids: [user.id])
end
end
end
......@@ -794,6 +809,14 @@ RSpec.describe MergeRequests::UpdateService, :mailer do
expect(merge_request.assignee_ids).to eq([user.id])
end
it 'updates the tracking when user ids are valid' do
expect(Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter)
.to receive(:track_users_assigned_to_mr)
.with(users: [user])
update_merge_request(assignee_ids: [user.id])
end
it 'does not update assignee_id when user cannot read issue' do
non_member = create(:user)
original_assignees = merge_request.assignees
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment