Class: QaServer::ScenarioHistoryCache

Inherits:
Object
  • Object
show all
Extended by:
CacheKeys
Defined in:
app/cache_processors/qa_server/scenario_history_cache.rb

Constant Summary

Constants included from CacheKeys

CacheKeys::PERFORMANCE_DATATABLE_DATA_CACHE_KEY, CacheKeys::SCENARIO_RUN_FAILURE_DATA_CACHE_KEY, CacheKeys::SCENARIO_RUN_HISTORY_DATA_CACHE_KEY, CacheKeys::SCENARIO_RUN_HISTORY_UP_DOWN_DATA_CACHE_KEY, CacheKeys::SCENARIO_RUN_SUMMARY_DATA_CACHE_KEY

Class Method Summary collapse

Class Method Details

.historical_summary(force: false) ⇒ Object

Get a summary of the number of days passing/failing for scenario runs during configured time period

Examples:

auth_name, failing, passing

{ 'agrovoc' => { good: 31, bad: 2 },
  'geonames_ld4l_cache' => { good: 32, bad: 1 } }

Parameters:

  • force (Boolean) (defaults to: false)

    if true, run the tests even if the cache hasn’t expired; otherwise, use cache if not expired



18
19
20
21
22
23
# File 'app/cache_processors/qa_server/scenario_history_cache.rb', line 18

def historical_summary(force: false)
  Rails.cache.fetch(cache_key_for_historical_data, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
    QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryCache) - CALCULATING HISTORY of scenario runs (force: #{force})")
    scenario_history_class.historical_summary
  end
end

.historical_up_down_data(force: false) ⇒ Object

Get a status for each of the last 30 days for queries that succeeded or failed.

Examples:

{ auth_name => [:fully_up, :fully_up, :down, :mostly_up, … ], … }

{ 'agrovoc' => [ :fully_up, :fully_up, :down, :mostly_up, ...],
  'geonames_ld4l_cache' => [ :fully_up, :mostly_up, :down, :fully_up, :timeouts, ...] }

Parameters:

  • force (Boolean) (defaults to: false)

    if true, run the tests even if the cache hasn’t expired; otherwise, use cache if not expired



31
32
33
34
35
36
# File 'app/cache_processors/qa_server/scenario_history_cache.rb', line 31

def historical_up_down_data(force: false)
  Rails.cache.fetch(cache_key_for_historical_up_down_data, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
    QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryCache) - CALCULATING UP-DOWN STATUS HISTORY of scenario runs (force: #{force})")
    scenario_up_down_class.new.last_30_days
  end
end