qa_server 7.1.3 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.rubocop_fixme.yml +6 -0
- data/.travis.yml +4 -5
- data/CHANGELOG.md +36 -0
- data/Rakefile +1 -1
- data/app/assets/stylesheets/qa_server/_check-status.scss +36 -0
- data/app/cache_processors/concerns/qa_server/cache_keys.rb +0 -5
- data/app/cache_processors/qa_server/cache_expiry_service.rb +13 -8
- data/app/cache_processors/qa_server/job_id_cache.rb +29 -0
- data/app/cache_processors/qa_server/performance_cache.rb +34 -34
- data/app/cache_processors/qa_server/performance_day_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/performance_month_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/performance_year_graph_cache.rb +27 -0
- data/app/cache_processors/qa_server/scenario_history_cache.rb +7 -7
- data/app/cache_processors/qa_server/scenario_history_graph_cache.rb +12 -18
- data/app/cache_processors/qa_server/scenario_run_cache.rb +8 -8
- data/app/cache_processors/qa_server/scenario_run_failures_cache.rb +7 -7
- data/app/cache_processors/qa_server/scenario_run_summary_cache.rb +7 -7
- data/app/controllers/concerns/qa_server/authority_validation_behavior.rb +49 -44
- data/app/controllers/qa_server/check_status_controller.rb +92 -22
- data/app/controllers/qa_server/fetch_controller.rb +36 -36
- data/app/controllers/qa_server/monitor_status_controller.rb +105 -105
- data/app/jobs/qa_server/history_graph_job.rb +28 -0
- data/app/jobs/qa_server/monitor_tests_job.rb +19 -39
- data/app/jobs/qa_server/performance_day_graph_job.rb +45 -0
- data/app/jobs/qa_server/performance_month_graph_job.rb +45 -0
- data/app/jobs/qa_server/performance_per_byte_job.rb +85 -0
- data/app/jobs/qa_server/performance_year_graph_job.rb +45 -0
- data/app/loggers/qa_server/scenario_logger.rb +74 -4
- data/app/models/concerns/qa_server/performance_history_data_keys.rb +8 -0
- data/app/models/qa_server/authority_scenario.rb +4 -4
- data/app/models/qa_server/authority_status.rb +2 -2
- data/app/models/qa_server/authority_status_failure.rb +1 -1
- data/app/models/qa_server/performance_history.rb +2 -2
- data/app/models/qa_server/scenario_run_history.rb +52 -52
- data/app/models/qa_server/scenario_run_registry.rb +2 -2
- data/app/models/qa_server/scenarios.rb +26 -26
- data/app/models/qa_server/search_scenario.rb +18 -13
- data/app/models/qa_server/term_scenario.rb +29 -29
- data/app/prepends/prepended_linked_data/find_term.rb +40 -40
- data/app/prepends/prepended_linked_data/search_query.rb +36 -36
- data/app/prepends/prepended_rdf/rdf_graph.rb +7 -7
- data/app/presenters/concerns/qa_server/monitor_status/performance_datatable_behavior.rb +32 -32
- data/app/presenters/concerns/qa_server/monitor_status/performance_graph_behavior.rb +64 -65
- data/app/presenters/qa_server/check_status_presenter.rb +63 -7
- data/app/presenters/qa_server/monitor_status/history_presenter.rb +0 -2
- data/app/presenters/qa_server/monitor_status/performance_presenter.rb +0 -1
- data/app/services/concerns/qa_server/gruff_graph.rb +28 -0
- data/app/services/qa_server/authority_loader_service.rb +14 -14
- data/app/services/qa_server/authority_validator_service.rb +1 -0
- data/app/services/qa_server/database_migrator.rb +14 -14
- data/app/services/qa_server/history_graphing_service.rb +32 -36
- data/app/services/qa_server/performance_calculator_service.rb +80 -80
- data/app/services/qa_server/performance_datatable_service.rb +35 -35
- data/app/services/qa_server/performance_graph_data_service.rb +28 -28
- data/app/services/qa_server/performance_graphing_service.rb +60 -60
- data/app/services/qa_server/performance_per_byte_calculator_service.rb +88 -0
- data/app/services/qa_server/performance_per_byte_data_service.rb +41 -0
- data/app/services/qa_server/scenarios_loader_service.rb +1 -1
- data/app/services/qa_server/time_period_service.rb +21 -21
- data/app/validators/qa_server/scenario_validator.rb +99 -87
- data/app/validators/qa_server/search_scenario_validator.rb +67 -61
- data/app/validators/qa_server/term_scenario_validator.rb +20 -15
- data/app/views/qa_server/check_status/index.html.erb +120 -24
- data/config/locales/qa_server.en.yml +1 -0
- data/lib/generators/qa_server/assets_generator.rb +4 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/cerl_ld4l_cache.json +2 -2
- data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_aat_ld4l_cache.json +62 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/getty_tgn_ld4l_cache.json +28 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/isni_ld4l_cache.json +90 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/ligatus_ld4l_cache.json +133 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo2_ld4l_cache.json +248 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locnames_rwo3_ld4l_cache.json +248 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/locvocabs_ld4l_cache.json +117 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/mesh_nlm_ld4l_cache.json +135 -3
- data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_direct.json +1 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/oclcfast_ld4l_cache.json +1 -4
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_direct_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/agrovoc_ld4l_cache_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/cerl_ld4l_cache_validation.yml +23 -11
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/dbpedia_ld4l_cache_validation.yml +33 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_direct_validation.yml +35 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/geonames_ld4l_cache_validation.yml +58 -5
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_aat_ld4l_cache_validation.yml +256 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_tgn_ld4l_cache_validation.yml +35 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/getty_ulan_ld4l_cache_validation.yml +37 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/isni_ld4l_cache_validation.yml +10 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/ligatus_ld4l_cache_validation.yml +36 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locdemographics_ld4l_cache_validation.yml +73 -44
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locgenres_ld4l_cache_validation.yml +31 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_ld4l_cache_validation.yml +71 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locnames_rwo_ld4l_cache_validation.yml +70 -2
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locperformance_ld4l_cache_validation.yml +6 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locsubjects_ld4l_cache_validation.yml +32 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/locvocabs_ld4l_cache_validation.yml +184 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/mesh_nlm_ld4l_cache_validation.yml +51 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/nalt_ld4l_cache_validation.yml +37 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclc_fast_validation.yml +71 -5
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_direct_validation.yml +66 -1
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/oclcfast_ld4l_cache_validation.yml +57 -0
- data/lib/generators/qa_server/templates/config/authorities/linked_data/scenarios/rda_registry_ld4l_cache_validation.yml +310 -0
- data/lib/qa_server/configuration.rb +28 -24
- data/lib/qa_server/version.rb +1 -1
- data/qa_server.gemspec +1 -1
- data/spec/feature/accuracy_spec.rb +32 -0
- data/spec/spec_helper.rb +4 -0
- metadata +30 -13
- data/app/cache_processors/qa_server/performance_daily_graph_cache.rb +0 -60
- data/app/cache_processors/qa_server/performance_hourly_graph_cache.rb +0 -65
- data/app/cache_processors/qa_server/performance_monthly_graph_cache.rb +0 -60
- data/app/presenters/concerns/qa_server/monitor_status/gruff_graph.rb +0 -20
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
# This presenter class provides historical testing data needed by the view that monitors status of authorities.
|
|
3
3
|
module QaServer::MonitorStatus
|
|
4
4
|
class HistoryPresenter
|
|
5
|
-
include QaServer::MonitorStatus::GruffGraph
|
|
6
|
-
|
|
7
5
|
# @param parent [QaServer::MonitorStatusPresenter] parent presenter
|
|
8
6
|
# @param historical_summary_data [Array<Hash>] summary of past failuring runs per authority to drive chart
|
|
9
7
|
def initialize(parent:, historical_summary_data:)
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
# This presenter class provides performance data needed by the view that monitors status of authorities.
|
|
3
3
|
module QaServer::MonitorStatus
|
|
4
4
|
class PerformancePresenter
|
|
5
|
-
include QaServer::MonitorStatus::GruffGraph
|
|
6
5
|
include QaServer::MonitorStatus::PerformanceDatatableBehavior
|
|
7
6
|
include QaServer::MonitorStatus::PerformanceGraphBehavior
|
|
8
7
|
include QaServer::PerformanceHistoryDataKeys
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
require 'gruff'
|
|
4
|
+
|
|
5
|
+
# This module include provides graph methods for generating graphs with Gruff
|
|
6
|
+
module QaServer
|
|
7
|
+
module GruffGraph
|
|
8
|
+
private
|
|
9
|
+
|
|
10
|
+
# common path for displaying and writing
|
|
11
|
+
def graph_relative_path
|
|
12
|
+
File.join('qa_server', 'charts')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# used for displaying in a view with <image> tag
|
|
16
|
+
def graph_image_path
|
|
17
|
+
File.join('/', graph_relative_path)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# used for writing out the file
|
|
21
|
+
def graph_full_path(graph_filename)
|
|
22
|
+
path = Rails.root.join('public', graph_relative_path)
|
|
23
|
+
# path = Rails.root.join('app', 'assets', 'images', graph_relative_path)
|
|
24
|
+
FileUtils.mkdir_p path
|
|
25
|
+
File.join(path, graph_filename)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -22,24 +22,24 @@ module QaServer
|
|
|
22
22
|
authority
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
private
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
def authority_key(authority_name)
|
|
28
|
+
authority_name.upcase.to_sym
|
|
29
|
+
end
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
return nil
|
|
31
|
+
def load_authority(authority_name, status_log)
|
|
32
|
+
authority = Qa::Authorities::LinkedData::GenericAuthority.new(authority_key(authority_name))
|
|
33
|
+
if authority.blank?
|
|
34
|
+
if status_log.present?
|
|
35
|
+
status_log.add(authority_name: authority_name,
|
|
36
|
+
status: QaServer::ScenarioValidator::FAIL,
|
|
37
|
+
error_message: "Unable to load authority '#{authority_name}'; cause: UNKNOWN")
|
|
40
38
|
end
|
|
41
|
-
|
|
39
|
+
return nil
|
|
42
40
|
end
|
|
41
|
+
authority
|
|
42
|
+
end
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -14,6 +14,7 @@ module QaServer
|
|
|
14
14
|
|
|
15
15
|
VALIDATE_CONNECTIONS = validator_class::VALIDATE_CONNECTION
|
|
16
16
|
VALIDATE_ACCURACY = validator_class::VALIDATE_ACCURACY
|
|
17
|
+
VALIDATE_ACCURACY_COMPARISON = validator_class::VALIDATE_ACCURACY_COMPARISON
|
|
17
18
|
ALL_VALIDATIONS = validator_class::ALL_VALIDATIONS
|
|
18
19
|
DEFAULT_VALIDATION_TYPE = validator_class::DEFAULT_VALIDATION_TYPE
|
|
19
20
|
|
|
@@ -50,22 +50,22 @@ module QaServer
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
private
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
def migrations
|
|
56
|
+
Dir.chdir(self.class.migrations_dir) { Dir.glob('db/migrate/[0-9]*_*.rb.erb') }.sort
|
|
57
|
+
end
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
def parse_basename_from(filename)
|
|
60
|
+
# Add engine name to filename to mimic ``ActiveRecord::Migration.copy` behavior
|
|
61
|
+
filename.slice(/(?<dateprefix>\d)+_(?<basename>.+)\.erb/, 'basename').sub('.', '.qa_server.')
|
|
62
|
+
end
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
def migration_version
|
|
65
|
+
# Don't use AR migration versioning in Rails 4
|
|
66
|
+
return if Rails.version < '5.0.0'
|
|
67
|
+
# Specify the current major.minor version of Rails for AR migrations
|
|
68
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
69
|
+
end
|
|
70
70
|
end
|
|
71
71
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module QaServer
|
|
4
4
|
class HistoryGraphingService
|
|
5
5
|
class << self
|
|
6
|
-
include QaServer::
|
|
6
|
+
include QaServer::GruffGraph
|
|
7
7
|
|
|
8
8
|
HISTORICAL_GRAPH_FILENAME = 'historical_side_stacked_bar.png'
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ module QaServer
|
|
|
12
12
|
|
|
13
13
|
# Path to use with <image> tags
|
|
14
14
|
def history_graph_image_path
|
|
15
|
-
|
|
15
|
+
File.join(graph_image_path, HISTORICAL_GRAPH_FILENAME)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# @return [Boolean] true if image for graph exists; otherwise, false
|
|
@@ -29,45 +29,41 @@ module QaServer
|
|
|
29
29
|
QaServer.config.monitor_logger.warn("FAILED to write historical graph at #{history_graph_image_path}") unless history_graph_image_exists?
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
private
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def historical_graph_theme(g)
|
|
44
|
-
g.theme_pastel
|
|
45
|
-
g.colors = ['#ffcccc', '#ccffcc']
|
|
46
|
-
g.marker_font_size = 12
|
|
47
|
-
g.x_axis_increment = 10
|
|
48
|
-
end
|
|
34
|
+
def create_gruff_graph(reworked_data, full_path)
|
|
35
|
+
g = Gruff::SideStackedBar.new
|
|
36
|
+
historical_graph_theme(g)
|
|
37
|
+
g.labels = reworked_data[0]
|
|
38
|
+
g.data('Fail', reworked_data[1])
|
|
39
|
+
g.data('Pass', reworked_data[2])
|
|
40
|
+
g.write full_path
|
|
41
|
+
end
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
def historical_graph_theme(g)
|
|
44
|
+
g.theme_pastel
|
|
45
|
+
g.colors = ['#ffcccc', '#ccffcc']
|
|
46
|
+
g.marker_font_size = 12
|
|
47
|
+
g.x_axis_increment = 10
|
|
48
|
+
end
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
def historical_graph_full_path
|
|
51
|
+
graph_full_path(HISTORICAL_GRAPH_FILENAME)
|
|
52
|
+
end
|
|
57
53
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
[labels, fail_data, pass_data]
|
|
54
|
+
def rework_historical_data_for_gruff(data)
|
|
55
|
+
labels = {}
|
|
56
|
+
pass_data = []
|
|
57
|
+
fail_data = []
|
|
58
|
+
i = 0
|
|
59
|
+
data.each do |authname, authdata|
|
|
60
|
+
labels[i] = authname
|
|
61
|
+
i += 1
|
|
62
|
+
fail_data << authdata[:bad]
|
|
63
|
+
pass_data << authdata[:good]
|
|
70
64
|
end
|
|
65
|
+
[labels, fail_data, pass_data]
|
|
66
|
+
end
|
|
71
67
|
end
|
|
72
68
|
end
|
|
73
69
|
end
|
|
@@ -40,85 +40,85 @@ module QaServer
|
|
|
40
40
|
stats
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
def calculate_load_stats(avg, low, high)
|
|
46
|
+
stats[AVG_LOAD] = calculate_average(full_load_times) if avg
|
|
47
|
+
stats[LOW_LOAD] = calculate_10th_percentile(full_load_times) if low
|
|
48
|
+
stats[HIGH_LOAD] = calculate_90th_percentile(full_load_times) if high
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def calculate_retrieve_stats(avg, low, high)
|
|
52
|
+
stats[AVG_RETR] = calculate_average(retrieve_times) if avg
|
|
53
|
+
stats[LOW_RETR] = calculate_10th_percentile(retrieve_times) if low
|
|
54
|
+
stats[HIGH_RETR] = calculate_90th_percentile(retrieve_times) if high
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def calculate_graph_load_stats(avg, low, high)
|
|
58
|
+
stats[AVG_GRPH] = calculate_average(graph_load_times) if avg
|
|
59
|
+
stats[LOW_GRPH] = calculate_10th_percentile(graph_load_times) if low
|
|
60
|
+
stats[HIGH_GRPH] = calculate_90th_percentile(graph_load_times) if high
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def calculate_normalization_stats(avg, low, high)
|
|
64
|
+
stats[AVG_NORM] = calculate_average(norm_times) if avg
|
|
65
|
+
stats[LOW_NORM] = calculate_10th_percentile(norm_times) if low
|
|
66
|
+
stats[HIGH_NORM] = calculate_90th_percentile(norm_times) if high
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def calculate_action_stats(avg, low, high)
|
|
70
|
+
stats[AVG_ACTN] = calculate_average(action_times) if avg
|
|
71
|
+
stats[LOW_ACTN] = calculate_10th_percentile(action_times) if low
|
|
72
|
+
stats[HIGH_ACTN] = calculate_90th_percentile(action_times) if high
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def tenth_percentile_count(times)
|
|
76
|
+
percentile_count = (times.count * 0.1).round
|
|
77
|
+
percentile_count = 1 if percentile_count.zero? && times.count > 1
|
|
78
|
+
percentile_count
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def times(column)
|
|
82
|
+
where_clause = action.nil? ? "" : { "action" => action }
|
|
83
|
+
records.where(where_clause).where.not(column => nil).order(column).pluck(column)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def full_load_times
|
|
87
|
+
@full_load_times ||= times(:retrieve_plus_graph_load_time_ms)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def retrieve_times
|
|
91
|
+
@retrieve_times ||= times(:retrieve_time_ms)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def graph_load_times
|
|
95
|
+
@graph_load_times ||= times(:graph_load_time_ms)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def norm_times
|
|
99
|
+
@norm_times ||= times(:normalization_time_ms)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def action_times
|
|
103
|
+
@action_times ||= times(:action_time_ms)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def calculate_average(times)
|
|
107
|
+
return 0 if times.count.zero?
|
|
108
|
+
return times[0] if times.count == 1
|
|
109
|
+
times.inject(0.0) { |sum, el| sum + el } / times.count
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def calculate_10th_percentile(times)
|
|
113
|
+
return 0 if times.count.zero?
|
|
114
|
+
return times[0] if times.count == 1
|
|
115
|
+
times[tenth_percentile_count(times) - 1]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def calculate_90th_percentile(times)
|
|
119
|
+
return 0 if times.count.zero?
|
|
120
|
+
return times[0] if times.count == 1
|
|
121
|
+
times[times.count - tenth_percentile_count(times)]
|
|
122
|
+
end
|
|
123
123
|
end
|
|
124
124
|
end
|
|
@@ -32,48 +32,48 @@ module QaServer
|
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
private
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
37
|
+
def datatable_data_for_authority(authority_name: nil)
|
|
38
|
+
[:search, :fetch, :all_actions].each_with_object({}) do |action, hash|
|
|
39
|
+
hash[action] = data_table_stats(authority_name, action)
|
|
41
40
|
end
|
|
41
|
+
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
# Get statistics for data table.
|
|
44
|
+
# @param auth_name [String] limit statistics to records for the given authority (default: all authorities)
|
|
45
|
+
# @param action [Symbol] one of :search, :fetch, :all_actions
|
|
46
|
+
# @returns [Hash] performance statistics for the datatable during the expected time period
|
|
47
|
+
# @example
|
|
48
|
+
# { retrieve_avg_ms: 12.3, graph_load_avg_ms: 2.1, normalization_avg_ms: 4.2, full_request_avg_ms: 16.5,
|
|
49
|
+
# retrieve_10th_ms: 12.3, graph_load_10th_ms: 12.3, normalization_10th_ms: 4.2, full_request_10th_ms: 16.5,
|
|
50
|
+
# retrieve_90th_ms: 12.3, graph_load_90th_ms: 12.3, normalization_90th_ms: 4.2, full_request_90th_ms: 16.5 }
|
|
51
|
+
def data_table_stats(auth_name, action)
|
|
52
|
+
records = records_for_authority(auth_name)
|
|
53
|
+
stats_calculator_class.new(records, action: action).calculate_stats_with_percentiles
|
|
54
|
+
end
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
def expected_time_period
|
|
57
|
+
QaServer.config.performance_datatable_default_time_period
|
|
58
|
+
end
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
end
|
|
60
|
+
def records_for_authority(auth_name)
|
|
61
|
+
case expected_time_period
|
|
62
|
+
when :day
|
|
63
|
+
QaServer.config.performance_cache.write_all # only need to write if just using today's data
|
|
64
|
+
performance_data_class.where(QaServer::TimePeriodService.where_clause_for_last_24_hours(auth_name: auth_name))
|
|
65
|
+
when :month
|
|
66
|
+
performance_data_class.where(QaServer::TimePeriodService.where_clause_for_last_30_days(auth_name: auth_name))
|
|
67
|
+
when :year
|
|
68
|
+
performance_data_class.where(QaServer::TimePeriodService.where_clause_for_last_12_months(auth_name: auth_name))
|
|
69
|
+
else
|
|
70
|
+
all_records(auth_name)
|
|
72
71
|
end
|
|
72
|
+
end
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
def all_records(auth_name)
|
|
75
|
+
auth_name.nil? ? performance_data_class.all : performance_data_class.where(authority: auth_name)
|
|
76
|
+
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
end
|