Commit 0d15c12f authored by Giorgenes Gelatti's avatar Giorgenes Gelatti Committed by Toon Claes

Adds rolling package count to usage data

parent 68c0a78a
---
title: Adds monthly package data to usage ping
merge_request: 40452
author:
type: added
......@@ -181,6 +181,7 @@ module Gitlab
successful_deployments: deployment_count(Deployment.success.where(last_28_days_time_period)),
failed_deployments: deployment_count(Deployment.failed.where(last_28_days_time_period)),
# rubocop: enable UsageData/LargeTable:
packages: count(::Packages::Package.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))
}.tap do |data|
......
......@@ -101,6 +101,7 @@ FactoryBot.define do
create(:package, project: projects[0])
create(:package, project: projects[0])
create(:package, project: projects[1])
create(:package, created_at: 2.months.ago, project: projects[1])
ProjectFeature.first.update_attribute('repository_access_level', 0)
......
......@@ -479,7 +479,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(count_data[:project_snippets]).to eq(4)
expect(count_data[:projects_with_packages]).to eq(2)
expect(count_data[:packages]).to eq(3)
expect(count_data[:packages]).to eq(4)
end
it 'gathers object store usage correctly' do
......@@ -572,6 +572,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(counts_monthly[:snippets]).to eq(3)
expect(counts_monthly[:personal_snippets]).to eq(1)
expect(counts_monthly[:project_snippets]).to eq(2)
expect(counts_monthly[:packages]).to eq(3)
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