Commit 59d437f4 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch '355689-instrumentation-for-deployment-approvals-users' into 'master'

Resolve "Instrumentation for Deployment Approvals users"

See merge request gitlab-org/gitlab!84631
parents e52d938e d69d710f
---
key_path: usage_activity_by_stage_monthly.release.users_creating_deployment_approvals
description: Users who have used the deployment approvals feature by month
product_section: ops
product_stage: release
product_group: group::release
product_category: continuous_delivery
value_type: number
status: active
milestone: "14.10"
introduced_by_url:
time_frame: 28d
data_source: database
data_category: optional
instrumentation_class: CountUsersDeploymentApprovals
performance_indicator_type: []
distribution:
- ee
tier:
- premium
- ultimate
---
key_path: usage_activity_by_stage.release.users_creating_deployment_approvals
description: Users who have used the deployment approvals feature by all time
product_section: ops
product_stage: release
product_group: group::release
product_category: continuous_delivery
value_type: number
status: active
milestone: "14.10"
introduced_by_url:
time_frame: all
data_source: database
data_category: optional
instrumentation_class: CountUsersDeploymentApprovals
performance_indicator_type: []
distribution:
- ee
tier:
- premium
- ultimate
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountUsersDeploymentApprovals < DatabaseMetric
operation :distinct_count, column: :user_id
relation { ::Deployments::Approval }
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountUsersDeploymentApprovals do
let_it_be(:user) { create(:user) }
let_it_be(:deployment_approval) { create(:deployment_approval, user: user) }
let_it_be(:deployment_approval2) { create(:deployment_approval, user: user) }
let(:expected_value) { 1 }
let(:expected_query) { 'SELECT COUNT(DISTINCT "deployment_approvals"."user_id") FROM "deployment_approvals"' }
it_behaves_like 'a correct instrumented metric value and query', { time_frame: 'all' }
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