Commit bfcd42b1 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Add projects_with_enabled_alert_integrations usage ping

Add `projects_with_enabled_alert_integrations` usage ping
to count projects with at least 1 enabled integration
parent 8188bc2d
...@@ -161,6 +161,7 @@ module Gitlab ...@@ -161,6 +161,7 @@ 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_alerts_created: distinct_count(::AlertManagement::Alert, :project_id), projects_with_alerts_created: distinct_count(::AlertManagement::Alert, :project_id),
projects_with_enabled_alert_integrations: distinct_count(::AlertManagement::HttpIntegration.active, :project_id),
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), projects_with_terraform_reports: distinct_count(::Ci::JobArtifact.terraform_reports, :project_id),
projects_with_terraform_states: distinct_count(::Terraform::State, :project_id), projects_with_terraform_states: distinct_count(::Terraform::State, :project_id),
......
...@@ -52,6 +52,11 @@ FactoryBot.define do ...@@ -52,6 +52,11 @@ FactoryBot.define do
create(:protected_branch, project: projects[0]) create(:protected_branch, project: projects[0])
create(:protected_branch, name: 'main', project: projects[0]) create(:protected_branch, name: 'main', project: projects[0])
# Alert Management
create(:alert_management_http_integration, project: projects[0], name: 'DataDog')
create(:alert_management_http_integration, project: projects[0], name: 'DataCat')
create(:alert_management_http_integration, :inactive, project: projects[1], name: 'DataFox')
# Tracing # Tracing
create(:project_tracing_setting, project: projects[0]) create(:project_tracing_setting, project: projects[0])
......
...@@ -468,6 +468,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do ...@@ -468,6 +468,7 @@ RSpec.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_tracing_enabled]).to eq(1) expect(count_data[:projects_with_tracing_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_enabled_alert_integrations]).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[:projects_with_terraform_reports]).to eq(2)
expect(count_data[:projects_with_terraform_states]).to eq(2) expect(count_data[:projects_with_terraform_states]).to eq(2)
......
...@@ -98,6 +98,7 @@ module UsageDataHelpers ...@@ -98,6 +98,7 @@ module UsageDataHelpers
projects_with_repositories_enabled projects_with_repositories_enabled
projects_with_error_tracking_enabled projects_with_error_tracking_enabled
projects_with_alerts_service_enabled projects_with_alerts_service_enabled
projects_with_enabled_alert_integrations
projects_with_prometheus_alerts projects_with_prometheus_alerts
projects_with_tracing_enabled projects_with_tracing_enabled
projects_with_expiration_policy_enabled projects_with_expiration_policy_enabled
......
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