Skip to content

Show usage data download only if cache exists

What does this MR do and why?

Resolves https://gitlab.com/gitlab-org/product-intelligence/-/issues/524

ServicePing might take a long time to generate, so it might case http timeout. And in general, its not the ideal to run such a long running code within a http request.

The idea is to show Download/Preview Payload buttons only is ServicePing data was generated and stored in cache.

Rails.cache.exists? :usage_data

If data doesnt exists in cache we can show text with a few options

  • Enable Service ping in the settings
  • Generate service ping from console

Screenshots or screen recordings

Data exists in cache

cache

Cache is missing

no_cache

no_cache_help_links

How to set up and validate locally

To test missing cache:

Rails.cache.delete('usage_data')

To validate buttons presence when cache is missing:

To test missing cache:
```ruby
Rails.cache.write('usage_data', {})

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Niko Belokolodov

Merge request reports