scout_apm 2.1.8 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +9 -0
  3. data/lib/scout_apm.rb +3 -0
  4. data/lib/scout_apm/agent.rb +9 -6
  5. data/lib/scout_apm/agent/reporting.rb +5 -3
  6. data/lib/scout_apm/background_job_integrations/delayed_job.rb +47 -1
  7. data/lib/scout_apm/background_worker.rb +4 -0
  8. data/lib/scout_apm/config.rb +2 -1
  9. data/lib/scout_apm/environment.rb +1 -1
  10. data/lib/scout_apm/histogram.rb +11 -2
  11. data/lib/scout_apm/instruments/mongoid.rb +14 -1
  12. data/lib/scout_apm/instruments/percentile_sampler.rb +36 -19
  13. data/lib/scout_apm/instruments/process/process_cpu.rb +3 -2
  14. data/lib/scout_apm/instruments/process/process_memory.rb +3 -3
  15. data/lib/scout_apm/layer_converters/converter_base.rb +193 -0
  16. data/lib/scout_apm/layer_converters/slow_job_converter.rb +14 -73
  17. data/lib/scout_apm/layer_converters/slow_request_converter.rb +13 -85
  18. data/lib/scout_apm/metric_set.rb +6 -0
  19. data/lib/scout_apm/reporter.rb +53 -15
  20. data/lib/scout_apm/request_histograms.rb +4 -0
  21. data/lib/scout_apm/scored_item_set.rb +7 -0
  22. data/lib/scout_apm/serializers/histograms_serializer_to_json.rb +21 -0
  23. data/lib/scout_apm/serializers/payload_serializer.rb +9 -3
  24. data/lib/scout_apm/serializers/payload_serializer_to_json.rb +2 -1
  25. data/lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb +1 -1
  26. data/lib/scout_apm/slow_job_record.rb +4 -1
  27. data/lib/scout_apm/slow_transaction.rb +18 -2
  28. data/lib/scout_apm/store.rb +42 -11
  29. data/lib/scout_apm/tracked_request.rb +1 -1
  30. data/lib/scout_apm/utils/gzip_helper.rb +24 -0
  31. data/lib/scout_apm/utils/numbers.rb +14 -0
  32. data/lib/scout_apm/version.rb +1 -1
  33. data/test/test_helper.rb +10 -0
  34. data/test/unit/config_test.rb +7 -9
  35. data/test/unit/histogram_test.rb +14 -0
  36. data/test/unit/instruments/percentile_sampler_test.rb +137 -0
  37. data/test/unit/serializers/payload_serializer_test.rb +3 -3
  38. data/test/unit/store_test.rb +51 -0
  39. data/test/unit/utils/numbers_test.rb +15 -0
  40. metadata +10 -4
@@ -17,7 +17,7 @@ class PayloadSerializerTest < Minitest::Test
17
17
  :unique_id => "unique_idz",
18
18
  :agent_version => 123
19
19
  }
20
- payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [])
20
+ payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [], [])
21
21
 
22
22
  # symbol keys turn to strings
23
23
  formatted_metadata = {
@@ -58,7 +58,7 @@ class PayloadSerializerTest < Minitest::Test
58
58
  stats.total_exclusive_time = 0.07813208899999999
59
59
  }
60
60
  }
61
- payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize({}, metrics, {}, [], [])
61
+ payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize({}, metrics, {}, [], [], [])
62
62
  formatted_metrics = [
63
63
  {
64
64
  "key" => {
@@ -102,7 +102,7 @@ class PayloadSerializerTest < Minitest::Test
102
102
  :quotie => "here are some \"quotes\"",
103
103
  :payload_version => 2,
104
104
  }
105
- payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [])
105
+ payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [], [])
106
106
 
107
107
  # symbol keys turn to strings
108
108
  formatted_metadata = {
@@ -21,3 +21,54 @@ class StoreTest < Minitest::Test
21
21
  assert_equal({}, s.reporting_periods)
22
22
  end
23
23
  end
24
+
25
+ class StoreReportingPeriodTest < Minitest::Test
26
+ HistogramReport = ScoutApm::Instruments::HistogramReport
27
+
28
+ attr_reader :subject
29
+
30
+ def setup
31
+ @subject = ScoutApm::StoreReportingPeriod.new(ScoutApm::StoreReportingPeriodTimestamp.new)
32
+ end
33
+
34
+ # Check default values at creation time
35
+ def test_empty_values
36
+ assert_equal [], subject.histograms
37
+ assert_equal ScoutApm::ScoredItemSet.new, subject.request_traces
38
+ assert_equal ScoutApm::ScoredItemSet.new, subject.job_traces
39
+ assert_equal ScoutApm::MetricSet.new, subject.metric_set
40
+ end
41
+
42
+ def test_merge_histograms
43
+ histogramFoo1 = histogram
44
+ histogramFoo2 = histogram
45
+ histogramBar1 = histogram
46
+ histogramBar2 = histogram
47
+
48
+ # This assertion may be fragile to reordering in the merge_histograms! function.
49
+ histogramFoo1.expects(:combine!).with(histogramFoo2)
50
+ histogramBar1.expects(:combine!).with(histogramBar2)
51
+
52
+ subject.merge_histograms!([
53
+ HistogramReport.new("foo", histogramFoo1),
54
+ HistogramReport.new("bar", histogramBar1),
55
+ ])
56
+
57
+ subject.merge_histograms!([
58
+ HistogramReport.new("foo", histogramFoo2),
59
+ HistogramReport.new("bar", histogramBar2),
60
+ ])
61
+
62
+ result = subject.histograms
63
+ assert_equal 2, result.length
64
+ assert_equal ["bar", "foo"], result.map(&:name).sort
65
+ end
66
+
67
+ ###############################################################################
68
+ # Helpers
69
+ ###############################################################################
70
+ def histogram
71
+ max_bins = 20
72
+ ScoutApm::NumericHistogram.new(max_bins)
73
+ end
74
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../../test_helper'
2
+ require 'scout_apm/utils/numbers'
3
+
4
+ class NumbersTest < Minitest::Test
5
+ Numbers = ScoutApm::Utils::Numbers
6
+
7
+ def test_round
8
+ assert_equal 12, Numbers.round(12.1234567, 0)
9
+ assert_equal 12.1, Numbers.round(12.1234567, 1)
10
+ assert_equal 12.12, Numbers.round(12.1234567, 2)
11
+ assert_equal 12.123, Numbers.round(12.1234567, 3)
12
+
13
+ assert_equal 12, Numbers.round(12.0000, 2)
14
+ end
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-06 00:00:00.000000000 Z
12
+ date: 2016-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -189,6 +189,7 @@ files:
189
189
  - lib/scout_apm/scored_item_set.rb
190
190
  - lib/scout_apm/serializers/app_server_load_serializer.rb
191
191
  - lib/scout_apm/serializers/directive_serializer.rb
192
+ - lib/scout_apm/serializers/histograms_serializer_to_json.rb
192
193
  - lib/scout_apm/serializers/jobs_serializer_to_json.rb
193
194
  - lib/scout_apm/serializers/metrics_to_json_serializer.rb
194
195
  - lib/scout_apm/serializers/payload_serializer.rb
@@ -211,9 +212,11 @@ files:
211
212
  - lib/scout_apm/tracked_request.rb
212
213
  - lib/scout_apm/utils/active_record_metric_name.rb
213
214
  - lib/scout_apm/utils/backtrace_parser.rb
215
+ - lib/scout_apm/utils/gzip_helper.rb
214
216
  - lib/scout_apm/utils/installed_gems.rb
215
217
  - lib/scout_apm/utils/klass_helper.rb
216
218
  - lib/scout_apm/utils/null_logger.rb
219
+ - lib/scout_apm/utils/numbers.rb
217
220
  - lib/scout_apm/utils/sql_sanitizer.rb
218
221
  - lib/scout_apm/utils/sql_sanitizer_regex.rb
219
222
  - lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb
@@ -232,6 +235,7 @@ files:
232
235
  - test/unit/histogram_test.rb
233
236
  - test/unit/ignored_uris_test.rb
234
237
  - test/unit/instruments/active_record_instruments_test.rb
238
+ - test/unit/instruments/percentile_sampler_test.rb
235
239
  - test/unit/layaway_test.rb
236
240
  - test/unit/metric_set_test.rb
237
241
  - test/unit/scored_item_set_test.rb
@@ -242,6 +246,7 @@ files:
242
246
  - test/unit/store_test.rb
243
247
  - test/unit/utils/active_record_metric_name_test.rb
244
248
  - test/unit/utils/backtrace_parser_test.rb
249
+ - test/unit/utils/numbers_test.rb
245
250
  homepage: https://github.com/scoutapp/scout_apm_ruby
246
251
  licenses:
247
252
  - Proprietary (See LICENSE.md)
@@ -263,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
268
  version: '0'
264
269
  requirements: []
265
270
  rubyforge_project: scout_apm
266
- rubygems_version: 2.4.6
271
+ rubygems_version: 2.4.8
267
272
  signing_key:
268
273
  specification_version: 4
269
274
  summary: Ruby application performance monitoring
@@ -279,6 +284,7 @@ test_files:
279
284
  - test/unit/histogram_test.rb
280
285
  - test/unit/ignored_uris_test.rb
281
286
  - test/unit/instruments/active_record_instruments_test.rb
287
+ - test/unit/instruments/percentile_sampler_test.rb
282
288
  - test/unit/layaway_test.rb
283
289
  - test/unit/metric_set_test.rb
284
290
  - test/unit/scored_item_set_test.rb
@@ -289,4 +295,4 @@ test_files:
289
295
  - test/unit/store_test.rb
290
296
  - test/unit/utils/active_record_metric_name_test.rb
291
297
  - test/unit/utils/backtrace_parser_test.rb
292
- has_rdoc:
298
+ - test/unit/utils/numbers_test.rb