Commit 32843982 authored by Allison Browne's avatar Allison Browne Committed by Andreas Brandl

Count grafana integrated projects

Add a count of grafana integrated projects
within the usage ping
parent 126a1c0b
......@@ -16,6 +16,8 @@ class GrafanaIntegration < ApplicationRecord
validates :enabled, inclusion: { in: [true, false] }
scope :enabled, -> { where(enabled: true) }
def client
return unless enabled?
......
......@@ -78,6 +78,7 @@ module Gitlab
clusters_applications_knative: count(::Clusters::Applications::Knative.available),
clusters_applications_elastic_stack: count(::Clusters::Applications::ElasticStack.available),
in_review_folder: count(::Environment.in_review_folder),
grafana_integrated_projects: count(GrafanaIntegration.enabled),
groups: count(Group),
issues: count(Issue),
issues_with_associated_zoom_link: count(ZoomMeeting.added_to_issue),
......
......@@ -48,6 +48,10 @@ describe Gitlab::UsageData do
create(:clusters_applications_knative, :installed, cluster: gcp_cluster)
create(:clusters_applications_elastic_stack, :installed, cluster: gcp_cluster)
create(:grafana_integration, project: projects[0], enabled: true)
create(:grafana_integration, project: projects[1], enabled: true)
create(:grafana_integration, project: projects[2], enabled: false)
ProjectFeature.first.update_attribute('repository_access_level', 0)
end
......@@ -140,6 +144,7 @@ describe Gitlab::UsageData do
clusters_applications_knative
clusters_applications_elastic_stack
in_review_folder
grafana_integrated_projects
groups
issues
issues_with_associated_zoom_link
......@@ -221,6 +226,7 @@ describe Gitlab::UsageData do
expect(count_data[:clusters_applications_runner]).to eq(1)
expect(count_data[:clusters_applications_knative]).to eq(1)
expect(count_data[:clusters_applications_elastic_stack]).to eq(1)
expect(count_data[:grafana_integrated_projects]).to eq(2)
end
it 'works when queries time out' 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