Commit 258a1907 authored by Max Woolf's avatar Max Woolf

Add protected_branches_except_default to usage ping

Adds a new key to the usage ping that counts
the number of protected branches used in an
instance excluding branches named main, master
or the default for the instance.
parent 27bfa8a5
---
title: Add protected branches count to usage ping
merge_request: 38797
author:
type: added
......@@ -96,6 +96,7 @@ An event dictionary is a single source of truth that outlines what events and pr
| `projects_with_repositories_enabled` | `counts` | | | | |
| `projects_with_error_tracking_enabled` | `counts` | `monitor` | | | |
| `protected_branches` | `counts` | | | | |
| `protected_branches_except_default` | `counts` | | | CE+EE | All protected branches except `main`, `master` or the default |
| `releases` | `counts` | `release` | | | Unique release tags |
| `remote_mirrors` | `counts` | | | | |
| `requirements_created` | `counts` | | | | |
......
......@@ -140,6 +140,7 @@ module Gitlab
projects_with_terraform_reports: distinct_count(::Ci::JobArtifact.terraform_reports, :project_id),
projects_with_terraform_states: distinct_count(::Terraform::State, :project_id),
protected_branches: count(ProtectedBranch),
protected_branches_except_default: count(ProtectedBranch.where.not(name: ['main', 'master', Gitlab::CurrentSettings.default_branch_name])),
releases: count(Release),
remote_mirrors: count(RemoteMirror),
personal_snippets: count(PersonalSnippet),
......
......@@ -47,6 +47,8 @@ FactoryBot.define do
create(:zoom_meeting, project: projects[0], issue: projects[0].issues[2], issue_status: :added)
create_list(:zoom_meeting, 2, project: projects[0], issue: projects[0].issues[2], issue_status: :removed)
create(:sentry_issue, issue: projects[0].issues[0])
create(:protected_branch, project: projects[0])
create(:protected_branch, name: 'main', project: projects[0])
# Incident Labeled Issues
incident_label_attrs = IncidentManagement::CreateIncidentLabelService::LABEL_PROPERTIES
......
......@@ -354,6 +354,8 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
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_states]).to eq(2)
expect(count_data[:protected_branches]).to eq(2)
expect(count_data[:protected_branches_except_default]).to eq(1)
expect(count_data[:terraform_reports]).to eq(6)
expect(count_data[:terraform_states]).to eq(3)
expect(count_data[:issues_created_from_gitlab_error_tracking_ui]).to eq(1)
......
......@@ -119,6 +119,7 @@ module UsageDataHelpers
projects_with_terraform_states
pages_domains
protected_branches
protected_branches_except_default
releases
remote_mirrors
snippets
......
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