qa_server 5.0.3 → 5.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3407df755ae3f2b2868030cdd5f7c5f633b25bd
4
- data.tar.gz: 7f9d4d161ce0914c80a858f459022a89ec85cfe7
3
+ metadata.gz: 91196c2e5b8c6f31cb7c3e38e6fd7567cae793f8
4
+ data.tar.gz: 3fa8f94c8f584a7e9110d5a046bc5abf234e9f28
5
5
  SHA512:
6
- metadata.gz: c0380e8bfde89a4d92ba7c12e6379e71f4b4a7a87ff17e117c2834f7864cab187f9c133f4d34c1eb04453e71e13b9809c9da623f4a868def05661d4f8a6a0833
7
- data.tar.gz: 9e327af739bcacc9ec9f61f17178b97dbd57c0e5918d7e24b8522e3cccf2e0b746913dd603c7a4cbcd9764ae56e38df9f62b9d35026522f356c7a8a1c70af36b
6
+ metadata.gz: 46dd223510421a7a72f1c1f507ea2e33b2dd1064595fafd783b17f9f555056cb44b5f6e744afd1b08dcbbbabe77fa309e73f5e7fe4d1c84280efa69dc443b45a
7
+ data.tar.gz: bcecafa888be4eeaf4dc6bfb44acd6b4b70b4b239e8de64b12138945e6c8930b268ad40487d14da36d8e8ab7a7779df2f472c9c1e70efbf659ca5c7d3d17efc9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 5.1.0 (2019-12-10)
2
+
3
+ * allow suppression of performance data gathering
4
+
1
5
  ### 5.0.3 (2019-12-3)
2
6
 
3
7
  * bug fix - use correct parameters for search query
@@ -3,6 +3,8 @@ module PrependedLinkedData::FindTerm
3
3
  # Override Qa::Authorities::LinkedData::FindTerm#find method
4
4
  # @return [Hash] single term results in requested format
5
5
  def find(id, request_header: {}, language: nil, replacements: {}, subauth: nil, format: nil, performance_data: false) # rubocop:disable Metrics/ParameterLists
6
+ return super if QaServer.config.suppress_performance_gathering
7
+
6
8
  start_time_s = Time.now.to_f
7
9
  request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, format: format, performance_data: performance_data) if request_header.empty?
8
10
  saved_performance_data = performance_data || request_header[:performance_data]
@@ -33,6 +35,8 @@ module PrependedLinkedData::FindTerm
33
35
 
34
36
  # Override to append performance history record id into the URL to allow access to the record in RDF::Graph
35
37
  def load_graph(url:)
38
+ return super if QaServer.config.suppress_performance_gathering
39
+
36
40
  access_start_dt = Time.now.utc
37
41
 
38
42
  url += "&phid=#{@phid}"
@@ -44,8 +48,10 @@ module PrependedLinkedData::FindTerm
44
48
  Rails.logger.info("Time to receive data from authority: #{access_time_s}s")
45
49
  end
46
50
 
47
- # Temporary override to fix bug. Remove when QA PR #273 is merged and a new release is cut
51
+ # Temporary override to fix bug. Remove when QA Issue #271 is fixed and a new release is cut
48
52
  def performance_data?
53
+ return super if QaServer.config.suppress_performance_gathering
54
+
49
55
  @performance_data == true
50
56
  end
51
57
  end
@@ -3,6 +3,8 @@ module PrependedLinkedData::SearchQuery
3
3
  # Override Qa::Authorities::LinkedData::SearchQuery#search method
4
4
  # @return [String] json results for search query
5
5
  def search(query, request_header: {}, language: nil, replacements: {}, subauth: nil, context: false, performance_data: false) # rubocop:disable Metrics/ParameterLists
6
+ return super if QaServer.config.suppress_performance_gathering
7
+
6
8
  start_time_s = Time.now.to_f
7
9
  request_header = build_request_header(language: language, replacements: replacements, subauth: subauth, context: context, performance_data: performance_data) if request_header.empty?
8
10
  saved_performance_data = performance_data || request_header[:performance_data]
@@ -33,6 +35,8 @@ module PrependedLinkedData::SearchQuery
33
35
 
34
36
  # Override to append performance history record id into the URL to allow access to the record in RDF::Graph
35
37
  def load_graph(url:)
38
+ return super if QaServer.config.suppress_performance_gathering
39
+
36
40
  access_start_dt = Time.now.utc
37
41
 
38
42
  url += "&phid=#{@phid}"
@@ -12,6 +12,8 @@ module PrependedRdf::RdfGraph
12
12
  # Set set graph name of each loaded statement
13
13
  # @return [void]
14
14
  def load(url, graph_name: nil, **options) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
15
+ return super if QaServer.config.suppress_performance_gathering
16
+
15
17
  raise TypeError, "#{self} is immutable" if immutable?
16
18
  phid, real_url = parse_phid(url)
17
19
  ph_record = QaServer::PerformanceHistory.find(phid)
@@ -56,4 +56,9 @@ QaServer.config do |config|
56
56
  # config.navmenu_extra_leftitems = [
57
57
  # { label: 'Your Menu Item Label', url: 'http://your.menu.item/url' }
58
58
  # ]
59
+
60
+ # Performance data is gathered on every incoming query. If load is high, this can have a negative performance
61
+ # impact and may need to be suppressed. Performance stats will not be gathered when this config is true.
62
+ # @param [Boolean] do not gather performance data when true (defaults to false for backward compatibitily)
63
+ # config.suppress_performance_gathering = false
59
64
  end
@@ -114,5 +114,13 @@ module QaServer
114
114
  f.puts('action, http request, load graph, normalization, TOTAL, data size, authority')
115
115
  end
116
116
  end
117
+
118
+ # Performance data is gathered on every incoming query. If load is high, this can have a negative performance
119
+ # impact and may need to be suppressed. Performance stats will not be gathered when this config is true.
120
+ # @param [Boolean] do not gather performance data when true (defaults to false for backward compatibitily)
121
+ attr_writer :suppress_performance_gathering
122
+ def suppress_performance_gathering
123
+ @suppress_performance_gathering ||= false
124
+ end
117
125
  end
118
126
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module QaServer
3
- VERSION = '5.0.3'
3
+ VERSION = '5.1.0'
4
4
  end
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: 5.0.3
4
+ version: 5.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: 2019-12-04 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails