Commit 10a933c7 authored by Stan Hu's avatar Stan Hu

Merge branch 'ali/fix-snowplow-event-counts' into 'master'

[RUN AS-IF-FOSS] Fix `promoted_issues` usage ping counter

See merge request gitlab-org/gitlab!44628
parents a27b7839 e63a8230
...@@ -201,7 +201,7 @@ module Gitlab ...@@ -201,7 +201,7 @@ module Gitlab
personal_snippets: count(PersonalSnippet.where(last_28_days_time_period)), personal_snippets: count(PersonalSnippet.where(last_28_days_time_period)),
project_snippets: count(ProjectSnippet.where(last_28_days_time_period)) project_snippets: count(ProjectSnippet.where(last_28_days_time_period))
}.merge( }.merge(
snowplow_event_counts(time_period: last_28_days_time_period(column: :collector_tstamp)) snowplow_event_counts(last_28_days_time_period(column: :collector_tstamp))
).tap do |data| ).tap do |data|
data[:snippets] = data[:personal_snippets] + data[:project_snippets] data[:snippets] = data[:personal_snippets] + data[:project_snippets]
end end
......
...@@ -587,8 +587,17 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -587,8 +587,17 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
end end
describe '.system_usage_data_monthly' do describe '.system_usage_data_monthly' do
let_it_be(:project) { create(:project) }
let!(:ud) { build(:usage_data) } let!(:ud) { build(:usage_data) }
before do
stub_application_setting(self_monitoring_project: project)
for_defined_days_back do
create(:product_analytics_event, project: project, se_category: 'epics', se_action: 'promote')
end
end
subject { described_class.system_usage_data_monthly } subject { described_class.system_usage_data_monthly }
it 'gathers monthly usage counts correctly' do it 'gathers monthly usage counts correctly' do
...@@ -601,6 +610,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -601,6 +610,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(counts_monthly[:personal_snippets]).to eq(1) expect(counts_monthly[:personal_snippets]).to eq(1)
expect(counts_monthly[:project_snippets]).to eq(2) expect(counts_monthly[:project_snippets]).to eq(2)
expect(counts_monthly[:packages]).to eq(3) expect(counts_monthly[:packages]).to eq(3)
expect(counts_monthly[:promoted_issues]).to eq(1)
end end
end end
......
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