Skip to content
Snippets Groups Projects
Unverified Commit 332d19b8 authored by Bojan Marjanović's avatar Bojan Marjanović :gem: Committed by GitLab
Browse files

Add OrphanedNamespacesMetric

parent 00225eb6
No related branches found
No related tags found
No related merge requests found
---
key_path: counts.orphaned_namespaces
description: Whether orphaned namespaces are present
product_group: tenant_scale
value_type: number
status: active
milestone: "17.6"
instrumentation_class: OrphanedNamespacesMetric
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/168983
time_frame: all
data_source: database
data_category: optional
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class OrphanedNamespacesMetric < GenericMetric
value do
::Namespace
.where.not(parent_id: nil)
.where('NOT EXISTS(SELECT 1 FROM namespaces p WHERE p.id = namespaces.parent_id)')
.exists?
end
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::OrphanedNamespacesMetric, feature_category: :service_ping do
let(:expected_value) { false }
it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', data_source: 'database' }
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment