diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /lib/tasks/gitlab/usage_data.rake | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'lib/tasks/gitlab/usage_data.rake')
-rw-r--r-- | lib/tasks/gitlab/usage_data.rake | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/tasks/gitlab/usage_data.rake b/lib/tasks/gitlab/usage_data.rake index 9f064ef4c0c..73a79427da3 100644 --- a/lib/tasks/gitlab/usage_data.rake +++ b/lib/tasks/gitlab/usage_data.rake @@ -17,11 +17,16 @@ namespace :gitlab do puts Gitlab::Json.pretty_generate(Gitlab::Usage::ServicePingReport.for(output: :all_metrics_values)) end + desc 'GitLab | UsageData | Generate non SQL data for usage ping in JSON' + task dump_non_sql_in_json: :environment do + puts Gitlab::Json.pretty_generate(Gitlab::Usage::ServicePingReport.for(output: :non_sql_metrics_values)) + end + desc 'GitLab | UsageData | Generate usage ping and send it to Versions Application' task generate_and_send: :environment do - result = ServicePing::SubmitService.new.execute + response = GitlabServicePingWorker.new.perform('triggered_from_cron' => false) - puts Gitlab::Json.pretty_generate(result.attributes) + puts response.body, response.code, response.message, response.headers.inspect end desc 'GitLab | UsageDataMetrics | Generate usage ping from metrics definition YAML files in JSON' @@ -51,6 +56,19 @@ namespace :gitlab do File.write(Gitlab::UsageDataCounters::CiTemplateUniqueCounter::KNOWN_EVENTS_FILE_PATH, banner + YAML.dump(all_includes).gsub(/ *$/m, '')) end + desc 'GitLab | UsageDataMetrics | Generate raw SQL metrics queries for RSpec' + task generate_sql_metrics_queries: :environment do + path = Rails.root.join('tmp', 'test') + + queries = Timecop.freeze(2021, 1, 1) do + Gitlab::Usage::ServicePingReport.for(output: :metrics_queries) + end + + FileUtils.mkdir_p(path) + FileUtils.chdir(path) + File.write('sql_metrics_queries.json', Gitlab::Json.pretty_generate(queries)) + end + def ci_template_includes_hash(source, template_directory = nil) Gitlab::UsageDataCounters::CiTemplateUniqueCounter.ci_templates("lib/gitlab/ci/templates/#{template_directory}").map do |template| expanded_template_name = Gitlab::UsageDataCounters::CiTemplateUniqueCounter.expand_template_name("#{template_directory}/#{template}") |