scout_apm 3.0.0.pre1 → 3.0.0.pre2

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 +12 -1
  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 +213 -0
  16. data/lib/scout_apm/layer_converters/slow_job_converter.rb +19 -93
  17. data/lib/scout_apm/layer_converters/slow_request_converter.rb +15 -100
  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 +2 -2
  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" => {
@@ -104,7 +104,7 @@ class PayloadSerializerTest < Minitest::Test
104
104
  :quotie => "here are some \"quotes\"",
105
105
  :payload_version => 2,
106
106
  }
107
- payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [])
107
+ payload = ScoutApm::Serializers::PayloadSerializerToJson.serialize(metadata, {}, {}, [], [], [])
108
108
 
109
109
  # symbol keys turn to strings
110
110
  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: 3.0.0.pre1
4
+ version: 3.0.0.pre2
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
@@ -193,6 +193,7 @@ files:
193
193
  - lib/scout_apm/scored_item_set.rb
194
194
  - lib/scout_apm/serializers/app_server_load_serializer.rb
195
195
  - lib/scout_apm/serializers/directive_serializer.rb
196
+ - lib/scout_apm/serializers/histograms_serializer_to_json.rb
196
197
  - lib/scout_apm/serializers/jobs_serializer_to_json.rb
197
198
  - lib/scout_apm/serializers/metrics_to_json_serializer.rb
198
199
  - lib/scout_apm/serializers/payload_serializer.rb
@@ -217,9 +218,11 @@ files:
217
218
  - lib/scout_apm/utils/active_record_metric_name.rb
218
219
  - lib/scout_apm/utils/backtrace_parser.rb
219
220
  - lib/scout_apm/utils/fake_stacks.rb
221
+ - lib/scout_apm/utils/gzip_helper.rb
220
222
  - lib/scout_apm/utils/installed_gems.rb
221
223
  - lib/scout_apm/utils/klass_helper.rb
222
224
  - lib/scout_apm/utils/null_logger.rb
225
+ - lib/scout_apm/utils/numbers.rb
223
226
  - lib/scout_apm/utils/sql_sanitizer.rb
224
227
  - lib/scout_apm/utils/sql_sanitizer_regex.rb
225
228
  - lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb
@@ -238,6 +241,7 @@ files:
238
241
  - test/unit/histogram_test.rb
239
242
  - test/unit/ignored_uris_test.rb
240
243
  - test/unit/instruments/active_record_instruments_test.rb
244
+ - test/unit/instruments/percentile_sampler_test.rb
241
245
  - test/unit/layaway_test.rb
242
246
  - test/unit/metric_set_test.rb
243
247
  - test/unit/scored_item_set_test.rb
@@ -248,6 +252,7 @@ files:
248
252
  - test/unit/store_test.rb
249
253
  - test/unit/utils/active_record_metric_name_test.rb
250
254
  - test/unit/utils/backtrace_parser_test.rb
255
+ - test/unit/utils/numbers_test.rb
251
256
  - tester.rb
252
257
  homepage: https://github.com/scoutapp/scout_apm_ruby
253
258
  licenses:
@@ -270,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
275
  version: 1.3.1
271
276
  requirements: []
272
277
  rubyforge_project: scout_apm
273
- rubygems_version: 2.4.6
278
+ rubygems_version: 2.4.8
274
279
  signing_key:
275
280
  specification_version: 4
276
281
  summary: Ruby application performance monitoring
@@ -286,6 +291,7 @@ test_files:
286
291
  - test/unit/histogram_test.rb
287
292
  - test/unit/ignored_uris_test.rb
288
293
  - test/unit/instruments/active_record_instruments_test.rb
294
+ - test/unit/instruments/percentile_sampler_test.rb
289
295
  - test/unit/layaway_test.rb
290
296
  - test/unit/metric_set_test.rb
291
297
  - test/unit/scored_item_set_test.rb
@@ -296,4 +302,4 @@ test_files:
296
302
  - test/unit/store_test.rb
297
303
  - test/unit/utils/active_record_metric_name_test.rb
298
304
  - test/unit/utils/backtrace_parser_test.rb
299
- has_rdoc:
305
+ - test/unit/utils/numbers_test.rb