Commit a5c45e37 authored by Arturo Herrero's avatar Arturo Herrero

Add telemetry for projects inheriting instance settings

This commit adds new counters following the pattern:
projects_inheriting_instance_#{service_name}_active

The new counters allow us to know the actual usage to determine how it's
getting used, instead of just that it's getting used.
parent 3762f8b4
---
title: Add telemetry for projects inheriting instance settings
merge_request: 38561
author:
type: other
......@@ -206,7 +206,7 @@ An event dictionary is a single source of truth that outlines what events and pr
| `templates_mattermost_active` | `counts` | `create` | | CE + EE | Total Mattermost templates enabled |
| `templates_mattermost_slash_commands_active` | `counts` | `create` | | CE + EE | Total Mattermost Slash Commands templates enabled |
| `templates_microsoft_teams_active` | `counts` | `create` | | CE + EE | Total Microsoft Teams templates enabled |
| `templates_mock_ci_active` | `counts` | `create` | | CE + EE | Total Mock Ci templates enabled |
| `templates_mock_ci_active` | `counts` | `create` | | CE + EE | Total Mock CI templates enabled |
| `templates_mock_deployment_active` | `counts` | `create` | | CE + EE | Total Mock Deployment templates enabled |
| `templates_mock_monitoring_active` | `counts` | `create` | | CE + EE | Total Mock Monitoring templates enabled |
| `templates_packagist_active` | `counts` | `create` | | CE + EE | Total Packagist templates enabled |
......@@ -221,6 +221,45 @@ An event dictionary is a single source of truth that outlines what events and pr
| `templates_unify_circuit_active` | `counts` | `create` | | CE + EE | Total Unify Circuit templates enabled |
| `templates_webex_teams_active` | `counts` | `create` | | CE + EE | Total Webex Teams templates enabled |
| `templates_youtrack_active` | `counts` | `create` | | CE + EE | Total YouTrack templates enabled |
| `projects_inheriting_instance_alerts_active` | `counts` | `create` | | CE + EE | Total Alerts integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_asana_active` | `counts` | `create` | | CE + EE | Total Asana integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_assembla_active` | `counts` | `create` | | CE + EE | Total Assembla integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_bamboo_active` | `counts` | `create` | | CE + EE | Total Bamboo integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_bugzilla_active` | `counts` | `create` | | CE + EE | Total Bugzilla integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_buildkite_active` | `counts` | `create` | | CE + EE | Total Buildkite integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_campfire_active` | `counts` | `create` | | CE + EE | Total Campfire integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_confluence_active` | `counts` | `create` | | CE + EE | Total Confluence integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_custom_issue_tracker_active` | `counts` | `create` | | CE + EE | Total Custom Issue Tracker integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_discord_active` | `counts` | `create` | | CE + EE | Total Discord integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_drone_ci_active` | `counts` | `create` | | CE + EE | Total Drone CI integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_emails_on_push_active` | `counts` | `create` | | CE + EE | Total Emails On Push integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_external_wiki_active` | `counts` | `create` | | CE + EE | Total External Wiki integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_flowdock_active` | `counts` | `create` | | CE + EE | Total Flowdock integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_github_active` | `counts` | `create` | | CE + EE | Total GitHub integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_gitlab_slack_application_active` | `counts` | `create` | | CE + EE | Total GitLab Slack Application integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_hangouts_chat_active` | `counts` | `create` | | CE + EE | Total Hangouts Chat integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_hipchat_active` | `counts` | `create` | | CE + EE | Total HipChat integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_irker_active` | `counts` | `create` | | CE + EE | Total Irker integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_jenkins_active` | `counts` | `create` | | CE + EE | Total Jenkins integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_jira_active` | `counts` | `create` | | CE + EE | Total Jira integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_mattermost_active` | `counts` | `create` | | CE + EE | Total Mattermost integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_mattermost_slash_commands_active` | `counts` | `create` | | CE + EE | Total Mattermost Slash Commands integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_microsoft_teams_active` | `counts` | `create` | | CE + EE | Total Microsoft Teams integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_mock_ci_active` | `counts` | `create` | | CE + EE | Total Mock CI integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_mock_deployment_active` | `counts` | `create` | | CE + EE | Total Mock Deployment integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_mock_monitoring_active` | `counts` | `create` | | CE + EE | Total Mock Monitoring integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_packagist_active` | `counts` | `create` | | CE + EE | Total Packagist integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_pipelines_email_active` | `counts` | `create` | | CE + EE | Total Pipelines Email integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_pivotaltracker_active` | `counts` | `create` | | CE + EE | Total Pivotal Tracker integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_prometheus_active` | `counts` | `create` | | CE + EE | Total Prometheus integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_pushover_active` | `counts` | `create` | | CE + EE | Total Pushover integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_redmine_active` | `counts` | `create` | | CE + EE | Total Redmine integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_slack_active` | `counts` | `create` | | CE + EE | Total Slack integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_slack_slash_commands_active` | `counts` | `create` | | CE + EE | Total Slack Slash Commands integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_teamcity_active` | `counts` | `create` | | CE + EE | Total Teamcity integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_unify_circuit_active` | `counts` | `create` | | CE + EE | Total Unify Circuit integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_webex_teams_active` | `counts` | `create` | | CE + EE | Total Webex Teams integrations enabled inheriting instance-level settings |
| `projects_inheriting_instance_youtrack_active` | `counts` | `create` | | CE + EE | Total YouTrack integrations enabled inheriting instance-level settings
| `projects_jira_server_active` | `counts` | | | | |
| `projects_jira_cloud_active` | `counts` | | | | |
| `projects_jira_dvcs_cloud_active` | `counts` | | | | |
......
......@@ -358,6 +358,7 @@ module Gitlab
response["projects_#{service_name}_active".to_sym] = count(Service.active.where(template: false, instance: false, type: "#{service_name}_service".camelize))
response["templates_#{service_name}_active".to_sym] = count(Service.active.where(template: true, type: "#{service_name}_service".camelize))
response["instances_#{service_name}_active".to_sym] = count(Service.active.where(instance: true, type: "#{service_name}_service".camelize))
response["projects_inheriting_instance_#{service_name}_active".to_sym] = count(Service.active.where.not(inherit_from_id: nil).where(type: "#{service_name}_service".camelize))
end.merge(jira_usage, jira_import_usage)
# rubocop: enable UsageData/LargeTable:
end
......
......@@ -24,7 +24,8 @@ FactoryBot.define do
create(:service, project: projects[2], type: 'SlackService', active: true)
create(:service, project: projects[2], type: 'MattermostService', active: false)
create(:service, :template, type: 'MattermostService', active: true)
create(:service, :instance, type: 'MattermostService', active: true)
matermost_instance = create(:service, :instance, type: 'MattermostService', active: true)
create(:service, project: projects[1], type: 'MattermostService', active: true, inherit_from_id: matermost_instance.id)
create(:service, project: projects[2], type: 'CustomIssueTrackerService', active: true)
create(:project_error_tracking_setting, project: projects[0])
create(:project_error_tracking_setting, project: projects[1], enabled: false)
......
......@@ -343,9 +343,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect(count_data[:projects_slack_active]).to eq(2)
expect(count_data[:projects_slack_slash_commands_active]).to eq(1)
expect(count_data[:projects_custom_issue_tracker_active]).to eq(1)
expect(count_data[:projects_mattermost_active]).to eq(0)
expect(count_data[:projects_mattermost_active]).to eq(1)
expect(count_data[:templates_mattermost_active]).to eq(1)
expect(count_data[:instances_mattermost_active]).to eq(1)
expect(count_data[:projects_inheriting_instance_mattermost_active]).to eq(1)
expect(count_data[:projects_with_repositories_enabled]).to eq(3)
expect(count_data[:projects_with_error_tracking_enabled]).to eq(1)
expect(count_data[:projects_with_alerts_service_enabled]).to eq(1)
......
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