scout_apm 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 788d920052b015909a11cc70a257ca8c1535a606
4
- data.tar.gz: 9c51b7cacdf71954f26b01edec521bf914bc882f
3
+ metadata.gz: 821081b647db6830249362c9ccd52dbbf81ad8e9
4
+ data.tar.gz: e411860c26b51a5f57d7173a66ad0b6b113f8ae8
5
5
  SHA512:
6
- metadata.gz: e0f7ac58629d5acb1da6ee681232fd4d23e51d8577468d4d00db1704fc04d636b18195d8e362efd9fb9d94e8da4cd91aa1e56ca16549e78457f5f67dd1cb44dc
7
- data.tar.gz: 79dced4225338843b29f2c37d74ba497bb3146998d5c905bea59aa6cadd44ea81c1980644a221ceebd06041171fdfb8ef06fbe9d2f20f25edc73f25e7b00f8ec
6
+ metadata.gz: 96213c4483fd035362120320e6e590ef8003b6ca329103fb94c568f6ec6bc63a776a6ef78fc46364b67ed1cbff821c67c58a86496305b39cb2651ec4984d5e89
7
+ data.tar.gz: 5c9b8e1019592a6612a6c15d0253e2a33e91481a4a994c066a6ffdf4c461c4a51238addae0b6322c7f927e123486338af18a75879452d69a407c7d30f22247c1
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.5.1
2
+
3
+ * Add `ignore_traces` config option to ignore SlowTransactions from certain URIs.
4
+
1
5
  # 1.5.0
2
6
 
3
7
  * Background Job instrumentation for Sidekiq and Sidekiq-backed ActiveJob
data/README.markdown CHANGED
@@ -19,24 +19,11 @@ Your config file should look like:
19
19
 
20
20
  production:
21
21
  <<: *defaults
22
-
23
- ## Supported Frameworks
24
22
 
25
- * Rails 2.2 through Rails 4
23
+ ## Docs
26
24
 
27
- ## Supported Rubies
28
-
29
- * Ruby 1.8.7 through Ruby 2.3
30
-
31
- ## Supported Application Servers
32
-
33
- * Phusion Passenger
34
- * Thin
35
- * WEBrick
36
- * Unicorn (make sure to add `preload_app true` to `config/unicorn.rb`)
37
- * Rainbows
38
- * Puma
25
+ For the complete list of supported frameworks, Rubies, etc, see our [help site](http://help.apm.scoutapp.com/).
39
26
 
40
27
  ## Help
41
28
 
42
- See our [help site](http://help.apm.scoutapp.com/) or email support@scoutapp.com if you need a hand.
29
+ Email support@scoutapp.com if you need a hand.
@@ -29,6 +29,7 @@ module ScoutApm
29
29
  'report_format' => 'json',
30
30
  'disabled_instruments' => [],
31
31
  'enable_background_jobs' => true,
32
+ 'ignore_traces' => [],
32
33
  }.freeze
33
34
 
34
35
  def initialize(config_path = nil)
@@ -2,61 +2,86 @@ module ScoutApm
2
2
  HistogramBin = Struct.new(:value, :count)
3
3
 
4
4
  class NumericHistogram
5
+ # This class should be threadsafe.
6
+ attr_reader :mutex
7
+
5
8
  attr_reader :max_bins
6
9
  attr_reader :bins
7
10
  attr_accessor :total
8
11
 
12
+ def marshal_dump
13
+ [@max_bins, @bins, @total]
14
+ end
15
+
16
+ def marshal_load(array)
17
+ @max_bins, @bins, @total = array
18
+ @mutex = Mutex.new
19
+ end
20
+
9
21
  def initialize(max_bins)
10
22
  @max_bins = max_bins
11
23
  @bins = []
12
24
  @total = 0
25
+ @mutex = Mutex.new
13
26
  end
14
27
 
15
28
  def add(new_value)
16
- @total += 1
17
- create_new_bin(new_value.to_f)
18
- trim
29
+ mutex.synchronize do
30
+ @total += 1
31
+ create_new_bin(new_value.to_f)
32
+ trim
33
+ end
19
34
  end
20
35
 
21
36
  def quantile(q)
22
- return 0 if total == 0
37
+ mutex.synchronize do
38
+ return 0 if total == 0
23
39
 
24
- if q > 1
25
- q = q / 100.0
26
- end
40
+ if q > 1
41
+ q = q / 100.0
42
+ end
27
43
 
28
- count = q.to_f * total.to_f
44
+ count = q.to_f * total.to_f
29
45
 
30
- bins.each_with_index do |bin, index|
31
- count -= bin.count
46
+ bins.each_with_index do |bin, index|
47
+ count -= bin.count
32
48
 
33
- if count <= 0
34
- return bin.value
49
+ if count <= 0
50
+ return bin.value
51
+ end
35
52
  end
36
- end
37
53
 
38
- # If we fell through, we were asking for the last (max) value
39
- return bins[-1].value
54
+ # If we fell through, we were asking for the last (max) value
55
+ return bins[-1].value
56
+ end
40
57
  end
41
58
 
42
59
  def mean
43
- if total == 0
44
- return 0
45
- end
60
+ mutex.synchronize do
61
+ if total == 0
62
+ return 0
63
+ end
46
64
 
47
- sum = bins.inject(0) { |s, bin| s + (bin.value * bin.count) }
48
- return sum.to_f / total.to_f
65
+ sum = bins.inject(0) { |s, bin| s + (bin.value * bin.count) }
66
+ return sum.to_f / total.to_f
67
+ end
49
68
  end
50
69
 
51
70
  def combine!(other)
52
- @bins = (other.bins + @bins).sort_by {|b| b.value }
53
- @total += other.total
54
- trim
55
- self
71
+ mutex.synchronize do
72
+ other.mutex.synchronize do
73
+ @bins = (other.bins + @bins).sort_by {|b| b.value }
74
+ @total += other.total
75
+ trim
76
+ self
77
+ end
78
+ end
56
79
  end
57
80
 
58
81
  def as_json
59
- bins.map{|b| [b.value, b.count]}
82
+ mutex.synchronize do
83
+ bins.map{|b| [b.value, b.count]}
84
+ end
60
85
  end
61
86
 
62
87
  private
@@ -22,6 +22,14 @@ module ScoutApm
22
22
 
23
23
  uri = request.annotations[:uri] || ""
24
24
 
25
+ ScoutApm::Agent.instance.config.value("ignore_traces").each do |pattern|
26
+ if /#{pattern}/ =~ uri
27
+ ScoutApm::Agent.instance.logger.debug("Skipped recording a trace for #{uri} due to `ignore_traces` pattern: #{pattern}")
28
+ return [nil, { meta => stat }]
29
+ end
30
+ end
31
+
32
+
25
33
  metrics = create_metrics
26
34
  # Disable stackprof output for now
27
35
  stackprof = [] # request.stackprof
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
4
4
 
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: 1.5.0
4
+ version: 1.5.1
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-04-25 00:00:00.000000000 Z
12
+ date: 2016-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest