Commit a8cbb3cd authored by Thong Kuah's avatar Thong Kuah

Add usage metric around agents which have a token

parent 880d6289
---
title: Add usage ping for distinct count for kubernetes agents for at least one token
merge_request: 40563
author:
type: other
......@@ -112,6 +112,7 @@ module Gitlab
clusters_applications_cilium: count(::Clusters::Applications::Cilium.available),
clusters_management_project: count(::Clusters::Cluster.with_management_project),
kubernetes_agents: count(::Clusters::Agent),
kubernetes_agents_with_token: distinct_count(::Clusters::AgentToken, :agent_id),
in_review_folder: count(::Environment.in_review_folder),
grafana_integrated_projects: count(GrafanaIntegration.enabled),
groups: count(Group),
......
......@@ -45,3 +45,4 @@ UsageData/DistinctCountByLargeForeignKey:
- :issue_id
- :merge_request_id
- :merge_requests.target_project_id
- :agent_id
......@@ -67,6 +67,7 @@ FactoryBot.define do
# Kubernetes agents
create(:cluster_agent, project: projects[0])
create(:cluster_agent_token, agent: create(:cluster_agent, project: projects[1]) )
# Enabled clusters
gcp_cluster = create(:cluster_provider_gcp, :created).cluster
......
......@@ -460,7 +460,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(count_data[:clusters_applications_jupyter]).to eq(1)
expect(count_data[:clusters_applications_cilium]).to eq(1)
expect(count_data[:clusters_management_project]).to eq(1)
expect(count_data[:kubernetes_agents]).to eq(1)
expect(count_data[:kubernetes_agents]).to eq(2)
expect(count_data[:kubernetes_agents_with_token]).to eq(1)
expect(count_data[:deployments]).to eq(4)
expect(count_data[:successful_deployments]).to eq(2)
......
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