scout_apm 2.4.6 → 2.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +4 -0
- data/lib/scout_apm/tracked_request.rb +35 -11
- 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: 07c4a946a4d02fc35ba227fe874ca2e743e19d77
|
4
|
+
data.tar.gz: 28d3f6e28caea313d1815766ed150739d51dd81c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44f9540db9e162bb66524011724cf11b11c5f02f6694f265a186407c73237eca99ca6799b9bcba07f25b6e9601da4d012c87cfc3f826a72dae2f8953d11b53d1
|
7
|
+
data.tar.gz: cb4fc4b106c966584cca12eb84167a67efebb7c79ebc079c360ee938eee7ca3369fb24d58c0b0e6fa818194857a66890cc2f1167e47a77e87d8d749c0ab3f87c
|
data/CHANGELOG.markdown
CHANGED
@@ -38,6 +38,13 @@ module ScoutApm
|
|
38
38
|
# An object that responds to `record!(TrackedRequest)` to store this tracked request
|
39
39
|
attr_reader :recorder
|
40
40
|
|
41
|
+
# When we see these layers, it means a real request is going through the
|
42
|
+
# system. We toggle a flag to turn on some slightly more expensive
|
43
|
+
# instrumentation (backtrace collection and the like) that would be too
|
44
|
+
# expensive in situations where the framework is constantly churning. We
|
45
|
+
# see that on Sidekiq.
|
46
|
+
REQUEST_TYPES = ["Controller", "Job"]
|
47
|
+
|
41
48
|
def initialize(agent_context, store)
|
42
49
|
@agent_context = agent_context
|
43
50
|
@store = store #this is passed in so we can use a real store (normal operation) or fake store (instant mode only)
|
@@ -52,6 +59,7 @@ module ScoutApm
|
|
52
59
|
@instant_key = nil
|
53
60
|
@mem_start = mem_usage
|
54
61
|
@recorder = agent_context.recorder
|
62
|
+
@real_request = false
|
55
63
|
|
56
64
|
ignore_request! if @recorder.nil?
|
57
65
|
end
|
@@ -65,6 +73,10 @@ module ScoutApm
|
|
65
73
|
return ignoring_start_layer if ignoring_request?
|
66
74
|
|
67
75
|
start_request(layer) unless @root_layer
|
76
|
+
|
77
|
+
if REQUEST_TYPES.include?(layer.type)
|
78
|
+
real_request!
|
79
|
+
end
|
68
80
|
@layers.push(layer)
|
69
81
|
end
|
70
82
|
|
@@ -105,6 +117,15 @@ module ScoutApm
|
|
105
117
|
end
|
106
118
|
end
|
107
119
|
|
120
|
+
def real_request!
|
121
|
+
@real_request = true
|
122
|
+
end
|
123
|
+
|
124
|
+
# Have we seen a "controller" or "job" layer so far?
|
125
|
+
def real_request?
|
126
|
+
@real_request
|
127
|
+
end
|
128
|
+
|
108
129
|
# Grab the currently running layer. Useful for adding additional data as we
|
109
130
|
# learn it. This is useful in ActiveRecord instruments, where we start the
|
110
131
|
# instrumentation early, and gradually learn more about the request that
|
@@ -128,7 +149,7 @@ module ScoutApm
|
|
128
149
|
# Only capture backtraces if we're in a real "request". Otherwise we
|
129
150
|
# can spend lot of time capturing backtraces from the internals of
|
130
151
|
# Sidekiq, only to throw them away immediately.
|
131
|
-
return false unless
|
152
|
+
return false unless real_request?
|
132
153
|
|
133
154
|
# Capture any individually slow layer.
|
134
155
|
return true if layer.total_exclusive_time > backtrace_threshold
|
@@ -218,16 +239,6 @@ module ScoutApm
|
|
218
239
|
@headers = headers
|
219
240
|
end
|
220
241
|
|
221
|
-
# This request is a job transaction iff it has a 'Job' layer
|
222
|
-
def job?
|
223
|
-
layer_finder.job != nil
|
224
|
-
end
|
225
|
-
|
226
|
-
# This request is a web transaction iff it has a 'Controller' layer
|
227
|
-
def web?
|
228
|
-
layer_finder.controller != nil
|
229
|
-
end
|
230
|
-
|
231
242
|
def instant?
|
232
243
|
return false if ignoring_request?
|
233
244
|
|
@@ -290,6 +301,19 @@ module ScoutApm
|
|
290
301
|
end
|
291
302
|
end
|
292
303
|
|
304
|
+
# This request is a job transaction iff it has a 'Job' layer
|
305
|
+
# Use this only during recording
|
306
|
+
def job?
|
307
|
+
layer_finder.job != nil
|
308
|
+
end
|
309
|
+
|
310
|
+
# This request is a web transaction iff it has a 'Controller' layer
|
311
|
+
# Use this only during recording
|
312
|
+
def web?
|
313
|
+
layer_finder.controller != nil
|
314
|
+
end
|
315
|
+
|
316
|
+
|
293
317
|
def layer_finder
|
294
318
|
@layer_finder ||= LayerConverters::FindLayerByType.new(self)
|
295
319
|
end
|
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: 2.4.
|
4
|
+
version: 2.4.7
|
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: 2018-01
|
12
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|