Commit d16eca98 authored by Max Woolf's avatar Max Woolf Committed by Mark Chao

Add projects with status checks to ping

Adds the total number of projects
with at least one external status
check for an instance to the Service Ping

Changelog: added
EE: true
parent f9c2abce
---
key_path: counts.projects_with_external_status_checks
description: Total number of distinct projects with external status checks
product_section: dev
product_stage: manage
product_group: compliance
product_category: "Compliance Management"
value_type: number
status: active
milestone: "14.9"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82427
time_frame: all
data_source: database
data_category: optional
instrumentation_class: CountProjectsWithExternalStatusChecksMetric
performance_indicator_type: []
distribution:
- ee
tier:
- ultimate
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountProjectsWithExternalStatusChecksMetric < DatabaseMetric
operation :distinct_count, column: 'project_id'
relation do
::MergeRequests::ExternalStatusCheck
end
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountProjectsWithExternalStatusChecksMetric do
let_it_be(:external_status_checks) { create_list(:external_status_check, 3) }
let_it_be(:project) { create(:project) }
it_behaves_like 'a correct instrumented metric value and query', { time_frame: 'all', data_source: 'database' } do
let(:expected_value) { 3 }
let(:expected_query) { "SELECT COUNT(DISTINCT \"external_status_checks\".\"project_id\") FROM \"external_status_checks\"" }
end
end
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