scout_apm 1.5.0 → 1.5.1
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 +4 -4
- data/CHANGELOG.markdown +4 -0
- data/README.markdown +3 -16
- data/lib/scout_apm/config.rb +1 -0
- data/lib/scout_apm/histogram.rb +50 -25
- data/lib/scout_apm/layer_converters/slow_request_converter.rb +8 -0
- data/lib/scout_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 821081b647db6830249362c9ccd52dbbf81ad8e9
|
4
|
+
data.tar.gz: e411860c26b51a5f57d7173a66ad0b6b113f8ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96213c4483fd035362120320e6e590ef8003b6ca329103fb94c568f6ec6bc63a776a6ef78fc46364b67ed1cbff821c67c58a86496305b39cb2651ec4984d5e89
|
7
|
+
data.tar.gz: 5c9b8e1019592a6612a6c15d0253e2a33e91481a4a994c066a6ffdf4c461c4a51238addae0b6322c7f927e123486338af18a75879452d69a407c7d30f22247c1
|
data/CHANGELOG.markdown
CHANGED
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
|
-
|
23
|
+
## Docs
|
26
24
|
|
27
|
-
|
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
|
-
|
29
|
+
Email support@scoutapp.com if you need a hand.
|
data/lib/scout_apm/config.rb
CHANGED
data/lib/scout_apm/histogram.rb
CHANGED
@@ -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
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
37
|
+
mutex.synchronize do
|
38
|
+
return 0 if total == 0
|
23
39
|
|
24
|
-
|
25
|
-
|
26
|
-
|
40
|
+
if q > 1
|
41
|
+
q = q / 100.0
|
42
|
+
end
|
27
43
|
|
28
|
-
|
44
|
+
count = q.to_f * total.to_f
|
29
45
|
|
30
|
-
|
31
|
-
|
46
|
+
bins.each_with_index do |bin, index|
|
47
|
+
count -= bin.count
|
32
48
|
|
33
|
-
|
34
|
-
|
49
|
+
if count <= 0
|
50
|
+
return bin.value
|
51
|
+
end
|
35
52
|
end
|
36
|
-
end
|
37
53
|
|
38
|
-
|
39
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
60
|
+
mutex.synchronize do
|
61
|
+
if total == 0
|
62
|
+
return 0
|
63
|
+
end
|
46
64
|
|
47
|
-
|
48
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
-
|
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
|
data/lib/scout_apm/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|