Skip to content

Add performance_indicator_type metric to metrics in counts_28d folder

Rajendra Kadam requested to merge counts28d-metrics-performance-type into master

What does this MR do?

Relates to #331520 (closed)

Script used as follows:

require 'yaml'
require 'csv'

def load_from_file(path)
  definition = File.read(path)
  definition = YAML.safe_load(definition)
end

def load_all_from_path!(glob_path)
	definition = load_from_file("config/metrics/counts_28d/#{glob_path}")
    definition
end

data = CSV.parse(File.read('xmau.csv'))

data.each do |node|
	metrics_path = node[1]
	smau = node[4]
	gmau = node[5]
	mau = node[9]
	paid_gmau = node[10]

	puts "Working for #{metrics_path}"
	paths ||= Dir.entries('config/metrics/counts_28d')[2..]
	paths.each do |glob_path|
    	defs = load_all_from_path!(glob_path)
  		if defs['key_path'] == metrics_path
  			defs['performance_indicator_type'] = []
  			if smau == "TRUE"
  				defs['performance_indicator_type'] << 'smau'
  			end
  			if gmau == "TRUE"
  				defs['performance_indicator_type'] << 'gmau'
  			end
  			if mau == "TRUE"
  				defs['performance_indicator_type'] << 'mau'
  			end
  			if paid_gmau == "TRUE"
  				defs['performance_indicator_type'] << 'paid_gmau'
  			end

  			File.open("config/metrics/counts_28d/#{glob_path}", "w") { |file| file.write(defs.to_yaml) }
  		end
  	end
end

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Rajendra Kadam

Merge request reports