Commit c8247e0e authored by Alina Mihaila's avatar Alina Mihaila Committed by Mikołaj Wawrzyniak

Use json pretty_generate in usage data rake tasks

parent 724cffdf
---
title: Add usage data rake tasks to prettify JSON output
merge_request: 49137
author:
type: added
...@@ -42,6 +42,7 @@ The following are available Rake tasks: ...@@ -42,6 +42,7 @@ The following are available Rake tasks:
| [Repository storage](../administration/raketasks/storage.md) | List and migrate existing projects and attachments from legacy storage to hashed storage. | | [Repository storage](../administration/raketasks/storage.md) | List and migrate existing projects and attachments from legacy storage to hashed storage. |
| [Uploads migrate](../administration/raketasks/uploads/migrate.md) | Migrate uploads between storage local and object storage. | | [Uploads migrate](../administration/raketasks/uploads/migrate.md) | Migrate uploads between storage local and object storage. |
| [Uploads sanitize](../administration/raketasks/uploads/sanitize.md) | Remove EXIF data from images uploaded to earlier versions of GitLab. | | [Uploads sanitize](../administration/raketasks/uploads/sanitize.md) | Remove EXIF data from images uploaded to earlier versions of GitLab. |
| [Usage data](../administration/troubleshooting/gitlab_rails_cheat_sheet.md#generate-usage-ping) | Generate and troubleshoot [Usage Ping](../development/product_analytics/usage_ping.md).|
| [User management](user_management.md) | Perform user management tasks. | | [User management](user_management.md) | Perform user management tasks. |
| [Webhooks administration](web_hooks.md) | Maintain project Webhooks. | | [Webhooks administration](web_hooks.md) | Maintain project Webhooks. |
| [X.509 signatures](x509_signatures.md) | Update X.509 commit signatures, useful if certificate store has changed. | | [X.509 signatures](x509_signatures.md) | Update X.509 commit signatures, useful if certificate store has changed. |
...@@ -12,13 +12,14 @@ namespace :gitlab do ...@@ -12,13 +12,14 @@ namespace :gitlab do
desc 'GitLab | UsageData | Generate usage ping in JSON' desc 'GitLab | UsageData | Generate usage ping in JSON'
task generate: :environment do task generate: :environment do
puts Gitlab::UsageData.to_json(force_refresh: true) puts Gitlab::Json.pretty_generate(Gitlab::UsageData.uncached_data)
end end
desc 'GitLab | UsageData | Generate usage ping and send it to Versions Application' desc 'GitLab | UsageData | Generate usage ping and send it to Versions Application'
task generate_and_send: :environment do task generate_and_send: :environment do
result = SubmitUsagePingService.new.execute result = SubmitUsagePingService.new.execute
puts result.inspect
puts Gitlab::Json.pretty_generate(result.attributes)
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