Skip to content
代码片段 群组 项目
未验证 提交 332d19b8 编辑于 作者: Bojan Marjanovic's avatar Bojan Marjanovic 提交者: GitLab
浏览文件

Add OrphanedNamespacesMetric

上级 00225eb6
No related branches found
No related tags 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% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册