Commit ccd9218a authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'mattkasa/207532-add-usage-ping-for-terraform-reports' into 'master'

Add terraform reports metrics to usage data

Closes #207532

See merge request gitlab-org/gitlab!31281
parents cad19781 48e9431e
...@@ -5,6 +5,7 @@ module Ci ...@@ -5,6 +5,7 @@ module Ci
include AfterCommitQueue include AfterCommitQueue
include ObjectStorage::BackgroundMove include ObjectStorage::BackgroundMove
include UpdateProjectStatistics include UpdateProjectStatistics
include UsageStatistics
include Sortable include Sortable
extend Gitlab::Ci::Model extend Gitlab::Ci::Model
......
---
title: Add usage data metrics for terraform reports
merge_request: 31281
author:
type: added
# frozen_string_literal: true
class AddIndexToCiJobArtifactsForTerraformReports < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_ci_job_artifacts_for_terraform_reports'
disable_ddl_transaction!
def up
add_concurrent_index :ci_job_artifacts, [:project_id, :id], where: 'file_type = 18', name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :ci_job_artifacts, INDEX_NAME
end
end
...@@ -9281,6 +9281,8 @@ CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON public.ci_instance_var ...@@ -9281,6 +9281,8 @@ CREATE UNIQUE INDEX index_ci_instance_variables_on_key ON public.ci_instance_var
CREATE INDEX index_ci_job_artifacts_file_store_is_null ON public.ci_job_artifacts USING btree (id) WHERE (file_store IS NULL); CREATE INDEX index_ci_job_artifacts_file_store_is_null ON public.ci_job_artifacts USING btree (id) WHERE (file_store IS NULL);
CREATE INDEX index_ci_job_artifacts_for_terraform_reports ON public.ci_job_artifacts USING btree (project_id, id) WHERE (file_type = 18);
CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON public.ci_job_artifacts USING btree (expire_at, job_id); CREATE INDEX index_ci_job_artifacts_on_expire_at_and_job_id ON public.ci_job_artifacts USING btree (expire_at, job_id);
CREATE INDEX index_ci_job_artifacts_on_file_store ON public.ci_job_artifacts USING btree (file_store); CREATE INDEX index_ci_job_artifacts_on_file_store ON public.ci_job_artifacts USING btree (file_store);
...@@ -13899,6 +13901,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -13899,6 +13901,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200511208012 20200511208012
20200511220023 20200511220023
20200512085150 20200512085150
20200512160004
20200512164334 20200512164334
20200513160930 20200513160930
20200513171959 20200513171959
......
...@@ -131,11 +131,13 @@ module Gitlab ...@@ -131,11 +131,13 @@ module Gitlab
projects_with_error_tracking_enabled: count(::ErrorTracking::ProjectErrorTrackingSetting.where(enabled: true)), projects_with_error_tracking_enabled: count(::ErrorTracking::ProjectErrorTrackingSetting.where(enabled: true)),
projects_with_alerts_service_enabled: count(AlertsService.active), projects_with_alerts_service_enabled: count(AlertsService.active),
projects_with_prometheus_alerts: distinct_count(PrometheusAlert, :project_id), projects_with_prometheus_alerts: distinct_count(PrometheusAlert, :project_id),
projects_with_terraform_reports: distinct_count(::Ci::JobArtifact.terraform_reports, :project_id),
protected_branches: count(ProtectedBranch), protected_branches: count(ProtectedBranch),
releases: count(Release), releases: count(Release),
remote_mirrors: count(RemoteMirror), remote_mirrors: count(RemoteMirror),
snippets: count(Snippet), snippets: count(Snippet),
suggestions: count(Suggestion), suggestions: count(Suggestion),
terraform_reports: count(::Ci::JobArtifact.terraform_reports),
todos: count(Todo), todos: count(Todo),
uploads: count(Upload), uploads: count(Upload),
web_hooks: count(WebHook), web_hooks: count(WebHook),
......
...@@ -33,6 +33,9 @@ FactoryBot.define do ...@@ -33,6 +33,9 @@ FactoryBot.define do
issues = create_list(:issue, 4, project: projects[0]) issues = create_list(:issue, 4, project: projects[0])
create_list(:prometheus_alert, 2, project: projects[0]) create_list(:prometheus_alert, 2, project: projects[0])
create(:prometheus_alert, project: projects[1]) create(:prometheus_alert, project: projects[1])
create(:merge_request, :simple, :with_terraform_reports, source_project: projects[0])
create(:merge_request, :rebased, :with_terraform_reports, source_project: projects[0])
create(:merge_request, :simple, :with_terraform_reports, source_project: projects[1])
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0], issue_status: :added) create(:zoom_meeting, project: projects[0], issue: projects[0].issues[0], issue_status: :added)
create_list(:zoom_meeting, 2, project: projects[0], issue: projects[0].issues[1], issue_status: :removed) create_list(:zoom_meeting, 2, project: projects[0], issue: projects[0].issues[1], issue_status: :removed)
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :added) create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :added)
......
...@@ -57,6 +57,8 @@ describe Gitlab::UsageData, :aggregate_failures do ...@@ -57,6 +57,8 @@ describe Gitlab::UsageData, :aggregate_failures do
expect(count_data[:projects_with_error_tracking_enabled]).to eq(1) expect(count_data[:projects_with_error_tracking_enabled]).to eq(1)
expect(count_data[:projects_with_alerts_service_enabled]).to eq(1) expect(count_data[:projects_with_alerts_service_enabled]).to eq(1)
expect(count_data[:projects_with_prometheus_alerts]).to eq(2) expect(count_data[:projects_with_prometheus_alerts]).to eq(2)
expect(count_data[:projects_with_terraform_reports]).to eq(2)
expect(count_data[:terraform_reports]).to eq(3)
expect(count_data[:issues_created_from_gitlab_error_tracking_ui]).to eq(1) expect(count_data[:issues_created_from_gitlab_error_tracking_ui]).to eq(1)
expect(count_data[:issues_with_associated_zoom_link]).to eq(2) expect(count_data[:issues_with_associated_zoom_link]).to eq(2)
expect(count_data[:issues_using_zoom_quick_actions]).to eq(3) expect(count_data[:issues_using_zoom_quick_actions]).to eq(3)
......
...@@ -117,12 +117,14 @@ module UsageDataHelpers ...@@ -117,12 +117,14 @@ module UsageDataHelpers
projects_with_expiration_policy_enabled_with_cadence_set_to_14d projects_with_expiration_policy_enabled_with_cadence_set_to_14d
projects_with_expiration_policy_enabled_with_cadence_set_to_1month projects_with_expiration_policy_enabled_with_cadence_set_to_1month
projects_with_expiration_policy_enabled_with_cadence_set_to_3month projects_with_expiration_policy_enabled_with_cadence_set_to_3month
projects_with_terraform_reports
pages_domains pages_domains
protected_branches protected_branches
releases releases
remote_mirrors remote_mirrors
snippets snippets
suggestions suggestions
terraform_reports
todos todos
uploads uploads
web_hooks web_hooks
......
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