Commit 38676f60 authored by alinamihaila's avatar alinamihaila

Add value_type to generator template

parent 756cb64a
# See Usage Ping metrics dictionary docs https://docs.gitlab.com/ee/development/usage_ping/metrics_dictionary.html # See Usage Ping metrics dictionary docs https://docs.gitlab.com/ee/development/usage_ping/metrics_dictionary.html
key_path: <%= key_path %> key_path: <%= key_path %>
value_type: description:
product_section:
product_stage:
product_group:
product_category: product_category:
stage: value_type: <%= value_type %>
status: status: implemented
milestone: milestone:
introduced_by_url: introduced_by_url:
group:
time_frame: <%= time_frame %> time_frame: <%= time_frame %>
data_source: data_source:
distribution: <%= distribution %> distribution: <%= distribution %>
# tier: ['free', 'starter', 'premium', 'ultimate', 'bronze', 'silver', 'gold'] # tier: ['free', 'premium', 'ultimate']
tier: tier:
...@@ -4,18 +4,18 @@ require 'rails/generators' ...@@ -4,18 +4,18 @@ require 'rails/generators'
module Gitlab module Gitlab
class UsageMetricDefinitionGenerator < Rails::Generators::Base class UsageMetricDefinitionGenerator < Rails::Generators::Base
Directory = Struct.new(:name, :time_frame) do Directory = Struct.new(:name, :time_frame, :value_type) do
def match?(str) def match?(str)
(name == str || time_frame == str) && str != 'none' (name == str || time_frame == str) && str != 'none'
end end
end end
TIME_FRAME_DIRS = [ TIME_FRAME_DIRS = [
Directory.new('counts_7d', '7d'), Directory.new('counts_7d', '7d', 'number'),
Directory.new('counts_28d', '28d'), Directory.new('counts_28d', '28d', 'number'),
Directory.new('counts_all', 'all'), Directory.new('counts_all', 'all', 'number'),
Directory.new('settings', 'none'), Directory.new('settings', 'none', 'boolean'),
Directory.new('license', 'none') Directory.new('license', 'none', 'string')
].freeze ].freeze
VALID_INPUT_DIRS = (TIME_FRAME_DIRS.flat_map { |d| [d.name, d.time_frame] } - %w(none)).freeze VALID_INPUT_DIRS = (TIME_FRAME_DIRS.flat_map { |d| [d.name, d.time_frame] } - %w(none)).freeze
...@@ -40,6 +40,10 @@ module Gitlab ...@@ -40,6 +40,10 @@ module Gitlab
directory&.time_frame directory&.time_frame
end end
def value_type
directory&.value_type
end
def distribution def distribution
value = ['ce'] value = ['ce']
value << 'ee' if ee? value << 'ee' if ee?
......
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