Commit a8040a61 authored by Igor's avatar Igor Committed by Lin Jen-Shin

Add usage pings for merge request creating

Code Review Usage Ping for Create SMAU
parent 830ea119
......@@ -27,6 +27,7 @@ module MergeRequests
issuable.cache_merge_request_closes_issues!(current_user)
create_pipeline_for(issuable, current_user)
issuable.update_head_pipeline
Gitlab::UsageDataCounters::MergeRequestCounter.count(:create)
super
end
......
---
title: Add usage pings for merge request creating
merge_request: 32059
author:
type: added
......@@ -142,7 +142,8 @@ module Gitlab
Gitlab::UsageDataCounters::SnippetCounter,
Gitlab::UsageDataCounters::SearchCounter,
Gitlab::UsageDataCounters::CycleAnalyticsCounter,
Gitlab::UsageDataCounters::SourceCodeCounter
Gitlab::UsageDataCounters::SourceCodeCounter,
Gitlab::UsageDataCounters::MergeRequestCounter
]
end
......
# frozen_string_literal: true
module Gitlab
module UsageDataCounters
class MergeRequestCounter < BaseCounter
KNOWN_EVENTS = %w[create].freeze
PREFIX = 'merge_request'
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::UsageDataCounters::MergeRequestCounter do
it_behaves_like 'a redis usage counter', 'Merge Request', :create
it_behaves_like 'a redis usage counter with totals', :merge_request, create: 5
end
......@@ -69,6 +69,7 @@ describe Gitlab::UsageData do
snippet_update: a_kind_of(Integer),
snippet_comment: a_kind_of(Integer),
merge_request_comment: a_kind_of(Integer),
merge_request_create: a_kind_of(Integer),
commit_comment: a_kind_of(Integer),
wiki_pages_create: a_kind_of(Integer),
wiki_pages_update: a_kind_of(Integer),
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe MergeRequests::CreateService do
describe MergeRequests::CreateService, :clean_gitlab_redis_shared_state do
include ProjectForksHelper
let(:project) { create(:project, :repository) }
......@@ -285,6 +285,12 @@ describe MergeRequests::CreateService do
end
end
end
it 'increments the usage data counter of create event' do
counter = Gitlab::UsageDataCounters::MergeRequestCounter
expect { service.execute }.to change { counter.read(:create) }.by(1)
end
end
it_behaves_like 'new issuable record that supports quick actions' do
......
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