qa_server 7.0.0 → 7.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/app/cache_processors/concerns/qa_server/cache_keys.rb +1 -0
- data/app/cache_processors/qa_server/scenario_history_cache.rb +1 -1
- data/app/cache_processors/qa_server/scenario_history_graph_cache.rb +33 -0
- data/app/controllers/qa_server/check_status_controller.rb +5 -1
- data/app/controllers/qa_server/monitor_status_controller.rb +13 -3
- data/app/presenters/concerns/qa_server/monitor_status/performance_graph_behavior.rb +24 -6
- data/app/presenters/qa_server/monitor_status/current_status_presenter.rb +1 -1
- data/app/presenters/qa_server/monitor_status/history_presenter.rb +6 -45
- data/app/presenters/qa_server/monitor_status/performance_presenter.rb +2 -2
- data/app/services/qa_server/history_graphing_service.rb +73 -0
- data/app/services/qa_server/performance_graphing_service.rb +23 -14
- data/app/views/qa_server/monitor_status/_performance.html.erb +2 -2
- data/app/views/qa_server/monitor_status/_test_history.html.erb +1 -1
- data/app/views/qa_server/monitor_status/_test_summary.html.erb +1 -1
- data/lib/qa_server/configuration.rb +23 -6
- data/lib/qa_server/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f01bf8175022b615153f701ad3cd23c38243d2b
|
4
|
+
data.tar.gz: 90ba9bedee3dd3ed4aadd719d18864cf61456615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b73ad3afcdfe168bdd45edaf4bd147ef8dc169a72ed939f6698e43bc25b0f6217afbdfa43106f9816516852c80cfff5d5efb0a32368b80770849846798c2cc8f
|
7
|
+
data.tar.gz: 5b616e7cfcf15b7e04120c421b60c6ad2bccd8a8b9069b2043c8856036351311480ca7b05a65960d68135ed3c87f32a30d5310210a7584a8017adba270aaf444
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 7.1.0 (2020-02-20)
|
2
|
+
|
3
|
+
* allow performance cache size to be set by environment variable
|
4
|
+
* move generation of history graph to cache_processors
|
5
|
+
* log warning in monitor logger if graphs fail to create
|
6
|
+
* monitor_status page won't try to display graphs if graph file does not exist
|
7
|
+
|
1
8
|
### 7.0.0 (2020-02-19)
|
2
9
|
|
3
10
|
* refactor of caching system to simplify the process
|
@@ -6,6 +6,7 @@ module QaServer
|
|
6
6
|
SCENARIO_RUN_SUMMARY_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_summary_data"
|
7
7
|
SCENARIO_RUN_FAILURE_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_failure_data"
|
8
8
|
SCENARIO_RUN_HISTORY_DATA_CACHE_KEY = "QaServer--CacheKeys--scenario_run_history_data"
|
9
|
+
SCENARIO_RUN_HISTORY_GRAPH_CACHE_KEY = "QaServer--CacheKeys--scenario_run_history_graph"
|
9
10
|
|
10
11
|
PERFORMANCE_DATATABLE_DATA_CACHE_KEY = "QaServer--Cache--performance_datatable_data"
|
11
12
|
PERFORMANCE_GRAPH_HOURLY_DATA_CACHE_KEY = "QaServer--CacheKeys--performance_graph_hourly_data"
|
@@ -16,7 +16,7 @@ module QaServer
|
|
16
16
|
# 'geonames_ld4l_cache' => { good: 32, bad: 1 } }
|
17
17
|
def historical_summary(force: false)
|
18
18
|
Rails.cache.fetch(cache_key_for_historical_data, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
|
19
|
-
QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryCache) - CALCULATING HISTORY of scenario runs (force: force)")
|
19
|
+
QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryCache) - CALCULATING HISTORY of scenario runs (force: #{force})")
|
20
20
|
scenario_history_class.historical_summary
|
21
21
|
end
|
22
22
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generate graphs for the past 30 days using cached data. Graphs are generated only if the cache has expired.
|
3
|
+
module QaServer
|
4
|
+
class ScenarioHistoryGraphCache
|
5
|
+
class_attribute :graphing_service
|
6
|
+
self.graphing_service = QaServer::HistoryGraphingService
|
7
|
+
|
8
|
+
class << self
|
9
|
+
include QaServer::CacheKeys
|
10
|
+
include QaServer::MonitorStatus::GruffGraph
|
11
|
+
|
12
|
+
HISTORICAL_GRAPH_FILENAME = 'historical_side_stacked_bar.png'
|
13
|
+
|
14
|
+
# Generates graphs for the past 30 days for :search, :fetch, and :all actions for each authority.
|
15
|
+
# @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
|
16
|
+
def generate_graph(data:, force: false)
|
17
|
+
return unless QaServer::CacheExpiryService.cache_expired?(key: cache_key_for_force, force: force, next_expiry: next_expiry)
|
18
|
+
QaServer.config.monitor_logger.debug("(QaServer::ScenarioHistoryGraphCache) - GENERATING historical summary graph (force: #{force})")
|
19
|
+
graphing_service.generate_graph(data)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def cache_key_for_force
|
25
|
+
"#{SCENARIO_RUN_HISTORY_GRAPH_CACHE_KEY}--force"
|
26
|
+
end
|
27
|
+
|
28
|
+
def next_expiry
|
29
|
+
QaServer::CacheExpiryService.cache_expiry
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -41,8 +41,12 @@ module QaServer
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def log_header
|
44
|
-
QaServer.config.performance_cache_logger.debug("
|
44
|
+
QaServer.config.performance_cache_logger.debug("---------------------- check status (max_cache_size = #{max_cache_size}) ----------------------")
|
45
45
|
QaServer.config.performance_cache_logger.debug("(#{self.class}##{__method__}) check status page request (authority_name # #{authority_name})")
|
46
46
|
end
|
47
|
+
|
48
|
+
def max_cache_size
|
49
|
+
ActiveSupport::NumberHelper.number_to_human_size(QaServer.config.max_performance_cache_size)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
@@ -14,8 +14,7 @@ module QaServer
|
|
14
14
|
# Sets up presenter with data to display in the UI
|
15
15
|
def index
|
16
16
|
log_header
|
17
|
-
|
18
|
-
update_performance_graphs
|
17
|
+
perform_updates
|
19
18
|
commit_cache if commit_cache?
|
20
19
|
@presenter = presenter_class.new(current_summary: latest_summary,
|
21
20
|
current_failure_data: latest_failures,
|
@@ -27,6 +26,12 @@ module QaServer
|
|
27
26
|
|
28
27
|
private
|
29
28
|
|
29
|
+
def perform_updates
|
30
|
+
update_tests
|
31
|
+
update_historical_graph
|
32
|
+
update_performance_graphs
|
33
|
+
end
|
34
|
+
|
30
35
|
def update_tests
|
31
36
|
QaServer::ScenarioRunCache.run_tests(force: refresh_tests?)
|
32
37
|
end
|
@@ -51,7 +56,12 @@ module QaServer
|
|
51
56
|
# @returns [Array<Hash>] summary of passing/failing tests for each authority
|
52
57
|
# @see QaServer::ScenarioRunHistory#historical_summary for structure of output
|
53
58
|
def historical_data
|
54
|
-
QaServer::ScenarioHistoryCache.historical_summary(force: refresh_history?)
|
59
|
+
@historical_data ||= QaServer::ScenarioHistoryCache.historical_summary(force: refresh_history?)
|
60
|
+
end
|
61
|
+
|
62
|
+
def update_historical_graph
|
63
|
+
return unless QaServer.config.display_historical_graph?
|
64
|
+
QaServer::ScenarioHistoryGraphCache.generate_graph(data: historical_data, force: refresh_history?)
|
55
65
|
end
|
56
66
|
|
57
67
|
def performance_table_data
|
@@ -96,17 +96,29 @@ module QaServer::MonitorStatus
|
|
96
96
|
|
97
97
|
def performance_graphs_for_authority(graphs, auth_name)
|
98
98
|
[:search, :fetch, :all_actions].each do |action|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
day_graph = performance_for_day_graph(auth_name, action)
|
100
|
+
month_graph = performance_for_month_graph(auth_name, action)
|
101
|
+
year_graph = performance_for_year_graph(auth_name, action)
|
102
|
+
add_graphs(graphs, day_graph, month_graph, year_graph)
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
106
|
+
# only add the graphs if all 3 exist
|
107
|
+
def add_graphs(graphs, day_graph, month_graph, year_graph)
|
108
|
+
return unless day_graph[:exists] && month_graph[:exists] && year_graph[:exists]
|
109
|
+
graphs << day_graph
|
110
|
+
graphs << month_graph
|
111
|
+
graphs << year_graph
|
112
|
+
end
|
113
|
+
|
105
114
|
def performance_for_day_graph(auth_name, action)
|
115
|
+
filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :day)
|
116
|
+
exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :day)
|
106
117
|
{
|
107
118
|
action: action,
|
108
119
|
time_period: :day,
|
109
|
-
graph:
|
120
|
+
graph: filepath,
|
121
|
+
exists: exists,
|
110
122
|
label: "Performance data for the last 24 hours.",
|
111
123
|
authority_name: auth_name,
|
112
124
|
base_id: "performance-of-#{auth_name}"
|
@@ -114,10 +126,13 @@ module QaServer::MonitorStatus
|
|
114
126
|
end
|
115
127
|
|
116
128
|
def performance_for_month_graph(auth_name, action)
|
129
|
+
filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :month)
|
130
|
+
exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :month)
|
117
131
|
{
|
118
132
|
action: action,
|
119
133
|
time_period: :month,
|
120
|
-
graph:
|
134
|
+
graph: filepath,
|
135
|
+
exists: exists,
|
121
136
|
label: "Performance data for the last 30 days.",
|
122
137
|
authority_name: auth_name,
|
123
138
|
base_id: "performance-of-#{auth_name}"
|
@@ -125,10 +140,13 @@ module QaServer::MonitorStatus
|
|
125
140
|
end
|
126
141
|
|
127
142
|
def performance_for_year_graph(auth_name, action)
|
143
|
+
filepath = QaServer::PerformanceGraphingService.performance_graph_image_path(authority_name: auth_name, action: action, time_period: :year)
|
144
|
+
exists = QaServer::PerformanceGraphingService.performance_graph_image_exists?(authority_name: auth_name, action: action, time_period: :year)
|
128
145
|
{
|
129
146
|
action: action,
|
130
147
|
time_period: :year,
|
131
|
-
graph:
|
148
|
+
graph: filepath,
|
149
|
+
exists: exists,
|
132
150
|
label: "Performance data for the last 12 months.",
|
133
151
|
authority_name: auth_name,
|
134
152
|
base_id: "performance-of-#{auth_name}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This presenter class provides historical testing data needed by the view that monitors status of authorities.
|
3
3
|
module QaServer::MonitorStatus
|
4
|
-
class HistoryPresenter
|
4
|
+
class HistoryPresenter
|
5
5
|
include QaServer::MonitorStatus::GruffGraph
|
6
6
|
|
7
7
|
# @param parent [QaServer::MonitorStatusPresenter] parent presenter
|
@@ -19,6 +19,10 @@ module QaServer::MonitorStatus
|
|
19
19
|
@historical_summary_data
|
20
20
|
end
|
21
21
|
|
22
|
+
def historical_graph
|
23
|
+
QaServer::HistoryGraphingService.history_graph_image_path
|
24
|
+
end
|
25
|
+
|
22
26
|
# @return [Boolean] true if historical test data exists; otherwise false
|
23
27
|
def history?
|
24
28
|
@historical_summary_data.present?
|
@@ -50,18 +54,6 @@ module QaServer::MonitorStatus
|
|
50
54
|
QaServer::TimeService.pretty_date(history_end_dt)
|
51
55
|
end
|
52
56
|
|
53
|
-
def historical_graph
|
54
|
-
# g = Gruff::SideStackedBar.new('800x400')
|
55
|
-
g = Gruff::SideStackedBar.new
|
56
|
-
historical_graph_theme(g)
|
57
|
-
historical_data = rework_historical_data_for_gruff
|
58
|
-
g.labels = historical_data[0]
|
59
|
-
g.data('Fail', historical_data[1])
|
60
|
-
g.data('Pass', historical_data[2])
|
61
|
-
g.write historical_graph_full_path
|
62
|
-
File.join(graph_relative_path, historical_graph_filename)
|
63
|
-
end
|
64
|
-
|
65
57
|
# @return [String] the name of the css style class to use for the status cell based on the status of the scenario test.
|
66
58
|
def status_style_class(status)
|
67
59
|
"status-#{status[:status]}"
|
@@ -117,42 +109,11 @@ module QaServer::MonitorStatus
|
|
117
109
|
end
|
118
110
|
|
119
111
|
def display_historical_graph?
|
120
|
-
QaServer.config.display_historical_graph?
|
112
|
+
QaServer.config.display_historical_graph? && QaServer::HistoryGraphingService.history_graph_image_exists?
|
121
113
|
end
|
122
114
|
|
123
115
|
def display_historical_datatable?
|
124
116
|
QaServer.config.display_historical_datatable?
|
125
117
|
end
|
126
|
-
|
127
|
-
private
|
128
|
-
|
129
|
-
def historical_graph_theme(g)
|
130
|
-
g.theme_pastel
|
131
|
-
g.colors = ['#ffcccc', '#ccffcc']
|
132
|
-
g.marker_font_size = 12
|
133
|
-
g.x_axis_increment = 10
|
134
|
-
end
|
135
|
-
|
136
|
-
def historical_graph_full_path
|
137
|
-
graph_full_path(historical_graph_filename)
|
138
|
-
end
|
139
|
-
|
140
|
-
def historical_graph_filename
|
141
|
-
'historical_side_stacked_bar.png'
|
142
|
-
end
|
143
|
-
|
144
|
-
def rework_historical_data_for_gruff
|
145
|
-
labels = {}
|
146
|
-
pass_data = []
|
147
|
-
fail_data = []
|
148
|
-
i = 0
|
149
|
-
historical_summary.each do |auth, data|
|
150
|
-
labels[i] = auth
|
151
|
-
i += 1
|
152
|
-
fail_data << data[:bad]
|
153
|
-
pass_data << data[:good]
|
154
|
-
end
|
155
|
-
[labels, fail_data, pass_data]
|
156
|
-
end
|
157
118
|
end
|
158
119
|
end
|
@@ -25,11 +25,11 @@ module QaServer::MonitorStatus
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def display_performance_graph?
|
28
|
-
QaServer.config.display_performance_graph?
|
28
|
+
QaServer.config.display_performance_graph? && !performance_graphs.nil? && !performance_graphs.empty?
|
29
29
|
end
|
30
30
|
|
31
31
|
def display_performance_datatable?
|
32
|
-
QaServer.config.display_performance_datatable?
|
32
|
+
QaServer.config.display_performance_datatable? && !performance_data.nil?
|
33
33
|
end
|
34
34
|
|
35
35
|
def performance_data_authority_name(entry)
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This class sets creates the performance graphs for each authority during day, month, and year time periods for fetch and search actions.
|
3
|
+
module QaServer
|
4
|
+
class HistoryGraphingService
|
5
|
+
class << self
|
6
|
+
include QaServer::MonitorStatus::GruffGraph
|
7
|
+
|
8
|
+
HISTORICAL_GRAPH_FILENAME = 'historical_side_stacked_bar.png'
|
9
|
+
|
10
|
+
class_attribute :authority_list_class
|
11
|
+
self.authority_list_class = QaServer::AuthorityListerService
|
12
|
+
|
13
|
+
# Path to use with <image> tags
|
14
|
+
def history_graph_image_path
|
15
|
+
historical_graph_relative_path
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Boolean] true if image for graph exists; otherwise, false
|
19
|
+
def history_graph_image_exists?
|
20
|
+
File.exist? historical_graph_full_path
|
21
|
+
end
|
22
|
+
|
23
|
+
# Generate the graph of historical data
|
24
|
+
# @param data [Hash] data to use to generate the graph
|
25
|
+
# @see QaServer::ScenarioHistoricalCache.historical_summary for source of data
|
26
|
+
def generate_graph(data)
|
27
|
+
gruff_data = rework_historical_data_for_gruff(data)
|
28
|
+
create_gruff_graph(gruff_data, historical_graph_full_path)
|
29
|
+
QaServer.config.monitor_logger.warn("FAILED to write historical graph at #{history_graph_image_path}") unless history_graph_image_exists?
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
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
|
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
|
49
|
+
|
50
|
+
def historical_graph_full_path
|
51
|
+
graph_full_path(HISTORICAL_GRAPH_FILENAME)
|
52
|
+
end
|
53
|
+
|
54
|
+
def historical_graph_relative_path
|
55
|
+
File.join(graph_relative_path, HISTORICAL_GRAPH_FILENAME)
|
56
|
+
end
|
57
|
+
|
58
|
+
def rework_historical_data_for_gruff(data)
|
59
|
+
labels = {}
|
60
|
+
pass_data = []
|
61
|
+
fail_data = []
|
62
|
+
i = 0
|
63
|
+
data.each do |authname, authdata|
|
64
|
+
labels[i] = authname
|
65
|
+
i += 1
|
66
|
+
fail_data << authdata[:bad]
|
67
|
+
pass_data << authdata[:good]
|
68
|
+
end
|
69
|
+
[labels, fail_data, pass_data]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -12,9 +12,19 @@ module QaServer
|
|
12
12
|
# @param authority_name [String] name of the authority
|
13
13
|
# @param action [Symbol] action performed by the request (e.g. :search, :fetch, :all_actions)
|
14
14
|
# @param time_period [Symbol] time period for the graph (i.e. :day, :month, :year)
|
15
|
-
|
15
|
+
# @return [String] Path to use with <image> tags
|
16
|
+
def performance_graph_image_path(authority_name: ALL_AUTH, action:, time_period:)
|
16
17
|
File.join(graph_relative_path, graph_filename(authority_name, action, time_period))
|
17
18
|
end
|
19
|
+
alias performance_graph_file performance_graph_image_path
|
20
|
+
|
21
|
+
# @param authority_name [String] name of the authority
|
22
|
+
# @param action [Symbol] action performed by the request (e.g. :search, :fetch, :all_actions)
|
23
|
+
# @param time_period [Symbol] time period for the graph (i.e. :day, :month, :year)
|
24
|
+
# @return [Boolean] true if image for graph exists; otherwise, false
|
25
|
+
def performance_graph_image_exists?(authority_name: ALL_AUTH, action:, time_period:)
|
26
|
+
File.exist?(performance_graph_full_path(authority_name, action, time_period))
|
27
|
+
end
|
18
28
|
|
19
29
|
# Generate one 12 month graph for the authority and action given the graph data.
|
20
30
|
# @param authority_name [String] name of the authority
|
@@ -24,8 +34,9 @@ module QaServer
|
|
24
34
|
def generate_monthly_graph(authority_name: ALL_AUTH, action:, data:)
|
25
35
|
gruff_data = rework_performance_data_for_gruff(data, BY_MONTH)
|
26
36
|
create_gruff_graph(gruff_data,
|
27
|
-
|
37
|
+
performance_graph_full_path(authority_name, action, FOR_YEAR),
|
28
38
|
I18n.t('qa_server.monitor_status.performance.x_axis_month'))
|
39
|
+
log_failure(authority_name, action, BY_MONTH)
|
29
40
|
end
|
30
41
|
|
31
42
|
# Generate one 30 day graph for the authority and action given the graph data.
|
@@ -36,7 +47,7 @@ module QaServer
|
|
36
47
|
def generate_daily_graph(authority_name: ALL_AUTH, action:, data:)
|
37
48
|
gruff_data = rework_performance_data_for_gruff(data, BY_DAY)
|
38
49
|
create_gruff_graph(gruff_data,
|
39
|
-
|
50
|
+
performance_graph_full_path(authority_name, action, FOR_MONTH),
|
40
51
|
I18n.t('qa_server.monitor_status.performance.x_axis_day'))
|
41
52
|
end
|
42
53
|
|
@@ -48,22 +59,14 @@ module QaServer
|
|
48
59
|
def generate_hourly_graph(authority_name: ALL_AUTH, action:, data:)
|
49
60
|
gruff_data = rework_performance_data_for_gruff(data, BY_HOUR)
|
50
61
|
create_gruff_graph(gruff_data,
|
51
|
-
|
62
|
+
performance_graph_full_path(authority_name, action, FOR_DAY),
|
52
63
|
I18n.t('qa_server.monitor_status.performance.x_axis_hour'))
|
53
64
|
end
|
54
65
|
|
55
66
|
private
|
56
67
|
|
57
|
-
def
|
58
|
-
graph_full_path(graph_filename(authority_name, action,
|
59
|
-
end
|
60
|
-
|
61
|
-
def performance_for_month_graph_full_path(authority_name, action)
|
62
|
-
graph_full_path(graph_filename(authority_name, action, :month))
|
63
|
-
end
|
64
|
-
|
65
|
-
def performance_for_year_graph_full_path(authority_name, action)
|
66
|
-
graph_full_path(graph_filename(authority_name, action, :year))
|
68
|
+
def performance_graph_full_path(authority_name, action, time_period)
|
69
|
+
graph_full_path(graph_filename(authority_name, action, time_period))
|
67
70
|
end
|
68
71
|
|
69
72
|
def graph_filename(authority_name, action, time_period)
|
@@ -117,6 +120,12 @@ module QaServer
|
|
117
120
|
g.data(I18n.t('qa_server.monitor_status.performance.normalization_time_ms'), performance_data[3])
|
118
121
|
g.write performance_graph_full_path
|
119
122
|
end
|
123
|
+
|
124
|
+
def log_failure(authority_name, action, time_period)
|
125
|
+
relative_path = performance_graph_image_path(authority_name: authority_name, action: action, time_period: time_period)
|
126
|
+
exists = performance_graph_image_exists?(authority_name: authority_name, action: action, time_period: time_period)
|
127
|
+
QaServer.config.monitor_logger.warn("FAILED to write performance graph at #{relative_path}") unless exists
|
128
|
+
end
|
120
129
|
end
|
121
130
|
end
|
122
131
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div id="performance-data" class="status-section">
|
3
3
|
<h3><%= t('qa_server.monitor_status.performance.title') %></h3>
|
4
4
|
|
5
|
-
<% if @presenter.display_performance_graph?
|
5
|
+
<% if @presenter.display_performance_graph? %>
|
6
6
|
<script>
|
7
7
|
function switch_performance_view(base_id, time_period, action) {
|
8
8
|
document.getElementById(base_id+'<%= @presenter.performance_graph_data_section_id(action: :all_actions, time_period: :day) %>').className = 'performance-data-section-hidden';
|
@@ -81,7 +81,7 @@
|
|
81
81
|
</div>
|
82
82
|
<% end %>
|
83
83
|
|
84
|
-
<% if @presenter.display_performance_datatable?
|
84
|
+
<% if @presenter.display_performance_datatable? %>
|
85
85
|
<div id="performance-datatable-section">
|
86
86
|
<h4><%= t('qa_server.monitor_status.performance.datatable_desc') %></h4>
|
87
87
|
<p class="status-update-dtstamp"><%= t('qa_server.monitor_status.performance.datarange', from: @presenter.performance_data_start, to: @presenter.performance_data_end) %></p>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= image_tag(@presenter.historical_graph, alt: 'History Graph Unavailable') %>
|
7
7
|
<% end %>
|
8
8
|
|
9
|
-
<% if @presenter.display_historical_datatable?
|
9
|
+
<% if @presenter.display_historical_datatable? %>
|
10
10
|
<table class="status">
|
11
11
|
<tr>
|
12
12
|
<th><%= t('qa_server.monitor_status.history.authority') %></th>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
</table>
|
20
20
|
<p class="status-update-dtstamp"><%= t('qa_server.monitor_status.summary.last_updated', date: @presenter.last_updated) %></p>
|
21
21
|
|
22
|
-
<% if @presenter.failures
|
22
|
+
<% if @presenter.failures?%>
|
23
23
|
<div id="failures" class="status-section">
|
24
24
|
<h4><%= t('qa_server.monitor_status.failures.title') %></h4>
|
25
25
|
|
@@ -10,7 +10,7 @@ module QaServer
|
|
10
10
|
end
|
11
11
|
|
12
12
|
# Set preferred hour to expire caches related to slow running calculations (e.g. monitoring tests, performance data)
|
13
|
-
# @param [Integer] count of hours after midnight (0-23 with 0=midnight)
|
13
|
+
# @param offset [Integer] count of hours after midnight (0-23 with 0=midnight)
|
14
14
|
# @raise [ArgumentError] if offset is not between 0 and 23
|
15
15
|
# @example
|
16
16
|
# For preferred_time_zone_name of 'Eastern Time (US & Canada)', use 3 for slow down at midnight PT/3am ET
|
@@ -27,7 +27,7 @@ module QaServer
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# Set preferred hour to run monitoring tests (deprecated)
|
30
|
-
# @param [Integer] count of hours from midnight (0-23 with 0=midnight)
|
30
|
+
# @param offset [Integer] count of hours from midnight (0-23 with 0=midnight)
|
31
31
|
# @example
|
32
32
|
# For preferred_time_zone_name of 'Eastern Time (US & Canada)', use 3 for slow down at midnight PT/3am ET
|
33
33
|
# For preferred_time_zone_name of 'Pacific Time (US & Canada)', use 0 for slow down at midnight PT/3am ET
|
@@ -60,7 +60,7 @@ module QaServer
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# Historical datatable default time period.
|
63
|
-
# @param [Symbol] time period for calculating historical pass/fail (i.e., one of :month, :year, or :all)
|
63
|
+
# @param time_period [Symbol] time period for calculating historical pass/fail (i.e., one of :month, :year, or :all)
|
64
64
|
# @raise [ArgumentError] if time_period is not one of :month, :year, or :all
|
65
65
|
def historical_datatable_default_time_period=(time_period)
|
66
66
|
raise ArgumentError, 'time_period must be one of :day, :month, or :year' unless [:month, :year, :all].include? time_period
|
@@ -112,7 +112,7 @@ module QaServer
|
|
112
112
|
end
|
113
113
|
|
114
114
|
# Performance graph default time period for all graphs. All authorities will show the graph for this time period on page load.
|
115
|
-
# @param [Symbol] time period for default display of performance graphs (i.e., one of :day, :month, or :year)
|
115
|
+
# @param time_period [Symbol] time period for default display of performance graphs (i.e., one of :day, :month, or :year)
|
116
116
|
# @raise [ArgumentError] if time_period is not one of :day, :month, or :year
|
117
117
|
def performance_graph_default_time_period=(time_period)
|
118
118
|
raise ArgumentError, 'time_period must be one of :day, :month, or :year' unless [:day, :month, :year].include? time_period
|
@@ -134,7 +134,7 @@ module QaServer
|
|
134
134
|
end
|
135
135
|
|
136
136
|
# Performance datatable default time period for calculating stats.
|
137
|
-
# @param [Symbol] time period for calculating performance stats (i.e., one of :day, :month, :year, or :all)
|
137
|
+
# @param time_period [Symbol] time period for calculating performance stats (i.e., one of :day, :month, :year, or :all)
|
138
138
|
# @raise [ArgumentError] if time_period is not one of :day, :month, :year, or :all
|
139
139
|
def performance_datatable_default_time_period=(time_period)
|
140
140
|
raise ArgumentError, 'time_period must be one of :day, :month, :year, or :all' unless [:day, :month, :year, :all].include? time_period
|
@@ -205,7 +205,7 @@ module QaServer
|
|
205
205
|
# @param [Integer] maximum size of performance cache before flushing
|
206
206
|
attr_writer :max_performance_cache_size
|
207
207
|
def max_performance_cache_size
|
208
|
-
@max_performance_cache_size ||= 32.megabytes
|
208
|
+
@max_performance_cache_size ||= convert_size_to_bytes(ENV['MAX_PERFORMANCE_CACHE_SIZE']) || 32.megabytes
|
209
209
|
end
|
210
210
|
|
211
211
|
# For internal use only
|
@@ -242,5 +242,22 @@ module QaServer
|
|
242
242
|
def monitor_logger
|
243
243
|
@monitor_logger ||= Logger.new(ENV['MONITOR_LOG_PATH'] || File.join("log", "monitor.log"))
|
244
244
|
end
|
245
|
+
|
246
|
+
private
|
247
|
+
|
248
|
+
def convert_size_to_bytes(size)
|
249
|
+
md = size.match(/^(?<num>\d+)\s?(?<unit>\w+)?$/)
|
250
|
+
md[:num].to_i *
|
251
|
+
case md[:unit].upcase
|
252
|
+
when 'KB'
|
253
|
+
1024
|
254
|
+
when 'MB'
|
255
|
+
1024**2
|
256
|
+
when 'GB'
|
257
|
+
1024**3
|
258
|
+
else
|
259
|
+
1
|
260
|
+
end
|
261
|
+
end
|
245
262
|
end
|
246
263
|
end
|
data/lib/qa_server/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qa_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- E. Lynette Rayle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -346,6 +346,7 @@ files:
|
|
346
346
|
- app/cache_processors/qa_server/performance_hourly_graph_cache.rb
|
347
347
|
- app/cache_processors/qa_server/performance_monthly_graph_cache.rb
|
348
348
|
- app/cache_processors/qa_server/scenario_history_cache.rb
|
349
|
+
- app/cache_processors/qa_server/scenario_history_graph_cache.rb
|
349
350
|
- app/cache_processors/qa_server/scenario_run_cache.rb
|
350
351
|
- app/cache_processors/qa_server/scenario_run_failures_cache.rb
|
351
352
|
- app/cache_processors/qa_server/scenario_run_summary_cache.rb
|
@@ -387,6 +388,7 @@ files:
|
|
387
388
|
- app/services/qa_server/authority_loader_service.rb
|
388
389
|
- app/services/qa_server/authority_validator_service.rb
|
389
390
|
- app/services/qa_server/database_migrator.rb
|
391
|
+
- app/services/qa_server/history_graphing_service.rb
|
390
392
|
- app/services/qa_server/performance_calculator_service.rb
|
391
393
|
- app/services/qa_server/performance_datatable_service.rb
|
392
394
|
- app/services/qa_server/performance_graph_data_service.rb
|