2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
namespace :gitlab do
|
|
|
|
namespace :usage_data do
|
|
|
|
desc 'GitLab | UsageData | Generate raw SQLs for usage ping in YAML'
|
|
|
|
task dump_sql_in_yaml: :environment do
|
|
|
|
puts Gitlab::UsageDataQueries.uncached_data.to_yaml
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | UsageData | Generate raw SQLs for usage ping in JSON'
|
|
|
|
task dump_sql_in_json: :environment do
|
|
|
|
puts Gitlab::Json.pretty_generate(Gitlab::UsageDataQueries.uncached_data)
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
desc 'GitLab | UsageData | Generate usage ping in JSON'
|
|
|
|
task generate: :environment do
|
|
|
|
puts Gitlab::Json.pretty_generate(Gitlab::UsageData.uncached_data)
|
|
|
|
end
|
|
|
|
|
|
|
|
desc 'GitLab | UsageData | Generate usage ping and send it to Versions Application'
|
|
|
|
task generate_and_send: :environment do
|
|
|
|
result = SubmitUsagePingService.new.execute
|
|
|
|
|
|
|
|
puts Gitlab::Json.pretty_generate(result.attributes)
|
|
|
|
end
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
desc 'GitLab | UsageData | Generate metrics dictionary'
|
|
|
|
task generate_metrics_dictionary: :environment do
|
|
|
|
items = Gitlab::Usage::MetricDefinition.definitions
|
|
|
|
Gitlab::Usage::Docs::Renderer.new(items).write
|
|
|
|
end
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
end
|