Commit e636cfa7 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'am-add-boards-metric' into 'master'

Add CountBoardsMetric

See merge request gitlab-org/gitlab!60022
parents 06d92619 e952adee
--- ---
key_path: counts.boards key_path: counts.boards
description: Count of total Boards created description: Count of Boards created
product_section: dev product_section: dev
product_stage: plan product_stage: plan
product_group: group::project management product_group: group::project management
product_category: boards product_category: boards
value_type: number value_type: number
status: data_available status: data_available
time_frame: all time_frame: all
data_source: database data_source: database
instrumentation_class: 'Gitlab::Usage::Metrics::Instrumentations::CountBoardsMetric'
distribution: distribution:
- ce - ce
- ee - ee
tier: tier:
- free - free
- premium - premium
- ultimate - ultimate
...@@ -468,7 +468,7 @@ Tiers: `free` ...@@ -468,7 +468,7 @@ Tiers: `free`
### `counts.boards` ### `counts.boards`
Count of total Boards created Count of Boards created
[YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216181252_boards.yml) [YAML definition](https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/metrics/counts_all/20210216181252_boards.yml)
......
# frozen_string_literal: true
module Gitlab
module Usage
module Metrics
module Instrumentations
class CountBoardsMetric < DatabaseMetric
operation :count
relation { Board }
end
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Usage::Metrics::Instrumentations::CountBoardsMetric do
let_it_be(:board) { create(:board) }
it_behaves_like 'a correct instrumented metric value', { time_frame: 'all', data_source: 'database' }, 1
end
...@@ -20,6 +20,10 @@ RSpec.describe Gitlab::UsageDataMetrics do ...@@ -20,6 +20,10 @@ RSpec.describe Gitlab::UsageDataMetrics do
it 'includes top level keys' do it 'includes top level keys' do
expect(subject).to include(:uuid) expect(subject).to include(:uuid)
end end
it 'includes counts keys' do
expect(subject[:counts]).to include(:boards)
end
end end
end end
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