scout_apm 1.6.0 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da7b4f6ec7fe62d8ee8243439e1c98404d2257a5
4
- data.tar.gz: b3a4f52a7d88731fa0c603aef7b0a236535edb82
3
+ metadata.gz: cf9f6ca2e9039c82d55f3a6a120d3a9bb6b821d8
4
+ data.tar.gz: f7530422c05a1437175806886a4d2e1873e4c59d
5
5
  SHA512:
6
- metadata.gz: c74c1effbb0846908bd6f61f6bfc1976cac80fa40ec789974c45c2e4c2e04cc2043967480b05e1541989668f096644c7e7bfa51feb4eea2825696b542142cf99
7
- data.tar.gz: 3bb6ab6fbe7847c0c4cc952c23109189d03bad9f76a34afdde6e473c014de967a8d4e0c707ec766435d876f5346eda8bab7721a8167d6341932a794873cf86e3
6
+ metadata.gz: 5fd9a17e01253f7c2f1f1dea6933c94ea856411755e375442ab9dc85201f0618695c6aae72a3180f0d87e73827365a5b34e9b0f11591f1acd1965780346b708d
7
+ data.tar.gz: 2f49baa4dff8fab01ad7244b3298ea06ff424d24c682dd2dcd50ed53f6bc9231e16b7b29f9764c6e0658330fc630da0c0c537ec3bb5653c1fe52bc46555b2eba
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 1.6.1
2
+
3
+ * Remove old & unused references to Stackprof. Prevent interaction with intentional usage of Stackprof
4
+
1
5
  # 1.6.0
2
6
 
3
7
  * Dynamic algorithm for selecting when to collect traces. Now, we will collect a
Binary file
@@ -272,10 +272,6 @@ module ScoutApm
272
272
  install_instrument(ScoutApm::Instruments::Redis)
273
273
  install_instrument(ScoutApm::Instruments::InfluxDB)
274
274
  install_instrument(ScoutApm::Instruments::Elasticsearch)
275
-
276
- if StackProf.respond_to?(:fake?) && StackProf.fake?
277
- logger.info 'StackProf not found - add `gem "stackprof"` to your Gemfile to enable advanced code profiling (only for Ruby 2.1+)'
278
- end
279
275
  rescue
280
276
  logger.warn "Exception loading instruments:"
281
277
  logger.warn $!.message
@@ -26,7 +26,6 @@ module ScoutApm
26
26
  'host' => 'https://checkin.scoutapp.com',
27
27
  'direct_host' => 'https://apm.scoutapp.com',
28
28
  'log_level' => 'info',
29
- 'stackprof_interval' => 20000, # microseconds, 1000 = 1 millisecond, so 20k == 20 milliseconds
30
29
  'uri_reporting' => 'full_path',
31
30
  'report_format' => 'json',
32
31
  'disabled_instruments' => [],
@@ -39,8 +39,6 @@ module ScoutApm
39
39
  end
40
40
 
41
41
  metrics = create_metrics
42
- # Disable stackprof output for now
43
- stackprof = [] # request.stackprof
44
42
 
45
43
  SlowTransaction.new(uri,
46
44
  scope.legacy_metric_name,
@@ -48,7 +46,7 @@ module ScoutApm
48
46
  metrics,
49
47
  request.context,
50
48
  root_layer.stop_time,
51
- stackprof,
49
+ [], # stackprof
52
50
  @points)
53
51
  end
54
52
 
@@ -10,7 +10,6 @@ module ScoutApm
10
10
  attr_reader :context
11
11
  attr_reader :time
12
12
  attr_reader :prof
13
- attr_reader :raw_prof
14
13
 
15
14
  def initialize(uri, metric_name, total_call_time, metrics, context, time, raw_stackprof, score)
16
15
  @uri = uri
@@ -19,8 +18,7 @@ module ScoutApm
19
18
  @metrics = metrics
20
19
  @context = context
21
20
  @time = time
22
- @prof = ScoutApm::StackprofTreeCollapser.new(raw_stackprof).call
23
- @raw_prof = raw_stackprof # Send whole data up to server
21
+ @prof = []
24
22
  @score = score
25
23
  end
26
24
 
@@ -22,10 +22,6 @@ module ScoutApm
22
22
  # :queue_latency - how long a background Job spent in the queue before starting processing
23
23
  attr_reader :annotations
24
24
 
25
- # Nil until the request is finalized, at which point it will hold the
26
- # entire raw stackprof output for this request
27
- attr_reader :stackprof
28
-
29
25
  # Headers as recorded by rails
30
26
  # Can be nil if we never reach a Rails Controller
31
27
  attr_reader :headers
@@ -48,7 +44,6 @@ module ScoutApm
48
44
  @ignoring_children = false
49
45
  @context = Context.new
50
46
  @root_layer = nil
51
- @stackprof = nil
52
47
  @error = false
53
48
  end
54
49
 
@@ -117,21 +112,14 @@ module ScoutApm
117
112
  # Run at the beginning of the whole request
118
113
  #
119
114
  # * Capture the first layer as the root_layer
120
- # * Start Stackprof (disabling to avoid conflicts if stackprof is included as middleware since we aren't sending this up to server now)
121
115
  def start_request(layer)
122
116
  @root_layer = layer unless @root_layer # capture root layer
123
- #StackProf.start(:mode => :wall, :interval => ScoutApm::Agent.instance.config.value("stackprof_interval"))
124
117
  end
125
118
 
126
119
  # Run at the end of the whole request
127
120
  #
128
- # * Collect stackprof info
129
121
  # * Send the request off to be stored
130
122
  def stop_request
131
- # ScoutApm::Agent.instance.logger.debug("stop_request: #{annotations[:uri]}" )
132
- #StackProf.stop # disabling to avoid conflicts if stackprof is included as middleware since we aren't sending this up to server now
133
- #@stackprof = StackProf.results
134
-
135
123
  record!
136
124
  end
137
125
 
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
4
4
 
data/lib/scout_apm.rb CHANGED
@@ -18,11 +18,6 @@ require 'yaml'
18
18
  #####################################
19
19
  # Gem Requires
20
20
  #####################################
21
- begin
22
- require 'stackprof'
23
- rescue LoadError
24
- require 'scout_apm/utils/fake_stack_prof'
25
- end
26
21
 
27
22
  #####################################
28
23
  # Internal Requires
@@ -112,7 +107,6 @@ require 'scout_apm/metric_set'
112
107
  require 'scout_apm/store'
113
108
  require 'scout_apm/tracer'
114
109
  require 'scout_apm/context'
115
- require 'scout_apm/stackprof_tree_collapser'
116
110
 
117
111
  require 'scout_apm/metric_meta'
118
112
  require 'scout_apm/metric_stats'
data/lib/stacks.bundle ADDED
Binary file
@@ -6,7 +6,6 @@ require 'scout_apm/serializers/payload_serializer_to_json'
6
6
  require 'scout_apm/slow_transaction'
7
7
  require 'scout_apm/metric_meta'
8
8
  require 'scout_apm/metric_stats'
9
- require 'scout_apm/stackprof_tree_collapser'
10
9
  require 'scout_apm/utils/fake_stack_prof'
11
10
  require 'scout_apm/context'
12
11
  require 'ostruct'
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.6.0
4
+ version: 1.6.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-06-07 00:00:00.000000000 Z
12
+ date: 2016-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -80,6 +80,7 @@ files:
80
80
  - README.markdown
81
81
  - Rakefile
82
82
  - data/cacert.pem
83
+ - lib/allocations.bundle
83
84
  - lib/scout_apm.rb
84
85
  - lib/scout_apm/agent.rb
85
86
  - lib/scout_apm/agent/logging.rb
@@ -167,13 +168,11 @@ files:
167
168
  - lib/scout_apm/slow_request_policy.rb
168
169
  - lib/scout_apm/slow_transaction.rb
169
170
  - lib/scout_apm/stack_item.rb
170
- - lib/scout_apm/stackprof_tree_collapser.rb
171
171
  - lib/scout_apm/store.rb
172
172
  - lib/scout_apm/tracer.rb
173
173
  - lib/scout_apm/tracked_request.rb
174
174
  - lib/scout_apm/utils/active_record_metric_name.rb
175
175
  - lib/scout_apm/utils/backtrace_parser.rb
176
- - lib/scout_apm/utils/fake_stack_prof.rb
177
176
  - lib/scout_apm/utils/installed_gems.rb
178
177
  - lib/scout_apm/utils/null_logger.rb
179
178
  - lib/scout_apm/utils/sql_sanitizer.rb
@@ -182,6 +181,7 @@ files:
182
181
  - lib/scout_apm/utils/time.rb
183
182
  - lib/scout_apm/utils/unique_id.rb
184
183
  - lib/scout_apm/version.rb
184
+ - lib/stacks.bundle
185
185
  - scout_apm.gemspec
186
186
  - test/data/config_test_1.yml
187
187
  - test/test_helper.rb
@@ -1,103 +0,0 @@
1
- module ScoutApm
2
- class StackprofTreeCollapser
3
- attr_reader :raw_stackprof
4
- attr_reader :nodes
5
-
6
- def initialize(raw_stackprof)
7
- @raw_stackprof = raw_stackprof
8
-
9
- # Log the raw stackprof info
10
- #unless StackProf.respond_to?(:fake?) && StackProf.fake?
11
- # begin
12
- # ScoutApm::Agent.instance.logger.debug("StackProf - Samples: #{raw_stackprof[:samples]}, GC: #{raw_stackprof[:gc_samples]}, missed: #{raw_stackprof[:missed_samples]}, Interval: #{raw_stackprof[:interval]}")
13
- # rescue
14
- # ScoutApm::Agent.instance.logger.debug("StackProf Raw - #{raw_stackprof.inspect}")
15
- # end
16
- #end
17
- end
18
-
19
- def call
20
- build_tree
21
- connect_children
22
- total_samples_of_app_nodes
23
- rescue
24
- []
25
- end
26
-
27
- private
28
-
29
- def build_tree
30
- @nodes = raw_stackprof[:frames].map do |(frame_id, frame_data)|
31
- TreeNode.new(frame_id, # frame_id
32
- frame_data[:name], # name
33
- frame_data[:file], # file
34
- frame_data[:line], # line
35
- frame_data[:samples], # samples
36
- frame_data[:total_samples], # total_samples
37
- (frame_data[:edges] || {}), # children_edges [ { id => weight } ]
38
- [], # children [ treenode, ... ]
39
- [] # parents [ [treenode, int (weight) ], [...] ]
40
- )
41
- end
42
- end
43
-
44
- def connect_children
45
- nodes.each do |node|
46
- children = nodes.find_all { |n| node.children_edges.keys.include? n.frame_id }
47
-
48
- node.children_edges.each do |(frame_id, weight)|
49
- child = children.detect{ |c| c.frame_id == frame_id }
50
- child.parents << [node, weight]
51
- end
52
-
53
- node.children = children
54
- end
55
- end
56
-
57
- def in_app_nodes
58
- nodes.select {|n| n.app? }
59
- end
60
-
61
- def total_samples_of_app_nodes
62
- in_app_nodes.reject{|n| n.calls_only_app_nodes? && !n.has_samples? }.
63
- map{|n| { :samples => n.total_samples,
64
- :name => n.name,
65
- :file => n.file,
66
- :line => n.line
67
- }
68
- }
69
- end
70
-
71
- ###########################################
72
- # TreeNode class represents a single node.
73
- ###########################################
74
- TreeNode = Struct.new(:frame_id, :name, :file, :line, :samples, :total_samples,
75
- :children_edges, :children, :parents) do
76
- def app?
77
- @is_app ||= file =~ /^#{ScoutApm::Environment.instance.root}/
78
- end
79
-
80
- # Force object_id to be the equality mechanism, rather than struct's
81
- # default which delegates to == on each value. That is wrong because
82
- # we want to be able to dup a node in the tree construction process and
83
- # not have those compare equal to each other.
84
- def ==(other)
85
- object_id == other.object_id
86
- end
87
-
88
- def inspect
89
- "#{frame_id}: #{name} - ##{samples}\n" +
90
- " Parents: #{parents.map{ |(p, w)| "#{p.name}: #{w}"}.join("\n ") }\n" +
91
- " Children: #{children_edges.inspect} \n"
92
- end
93
-
94
- def calls_only_app_nodes?
95
- children.all?(&:app?)
96
- end
97
-
98
- def has_samples?
99
- samples > 0
100
- end
101
- end
102
- end
103
- end
@@ -1,40 +0,0 @@
1
- # A fake implementation of stackprof, for systems that don't support it.
2
- module StackProf
3
- def self.start(*args)
4
- @running = true
5
- end
6
-
7
- def self.stop(*args)
8
- @running = false
9
- end
10
-
11
- def self.running?
12
- !!@running
13
- end
14
-
15
- def self.run(*args)
16
- start
17
- yield
18
- stop
19
- results
20
- end
21
-
22
- def self.sample(*args)
23
- end
24
-
25
- def self.results(*args)
26
- {
27
- :version => 0.0,
28
- :mode => :wall,
29
- :interval => 1000,
30
- :samples => 0,
31
- :gc_samples => 0,
32
- :missed_samples => 0,
33
- :frames => {},
34
- }
35
- end
36
-
37
- def self.fake?
38
- true
39
- end
40
- end