Commit f1639cfe authored by Mark Chao's avatar Mark Chao

Merge branch '334967-projects-with-external-checks-service-ping' into 'master'

Add projects with status checks to ping

See merge request gitlab-org/gitlab!82427
parents 2cc394fa d16eca98
---
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