scout_apm 2.2.0.pre1 → 2.2.0.pre2
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/ext/stacks/stacks.c +7 -1
- data/lib/scout_apm.rb +2 -0
- data/lib/scout_apm/agent.rb +3 -0
- data/lib/scout_apm/instant/middleware.rb +1 -2
- data/lib/scout_apm/layaway.rb +1 -1
- data/lib/scout_apm/store.rb +10 -5
- data/lib/scout_apm/version.rb +1 -1
- data/test/unit/store_test.rb +23 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1ea1128aa9aa0aa0b5086860810f324ffe732c
|
4
|
+
data.tar.gz: 00e3f0e517bfb8b580205bd7709a040fd13d611a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea83409eb9f21cccbfc9aeeeeae3f4a22113cfdd13fa1f51ede6df3422ed5a0d2b7a15d922c7d132632c486430372c68616482b9d2356fd80689ba0cf9d74e8
|
7
|
+
data.tar.gz: 43c32ce10c3e01134904e19a1d2068c1b4a06ac928d44dbb3f1fd46e781ab98414737f9c004858f3ced00fe29534f91af0804f9b2559364ac3e15ad856020918
|
data/ext/stacks/stacks.c
CHANGED
@@ -69,6 +69,12 @@ const long INTERVAL = 1000; // 1ms
|
|
69
69
|
|
70
70
|
#endif
|
71
71
|
|
72
|
+
#ifdef T_IMEMO
|
73
|
+
#define VALID_RUBY_FRAME T_IMEMO
|
74
|
+
#else
|
75
|
+
#define VALID_RUBY_FRAME T_DATA
|
76
|
+
#endif
|
77
|
+
|
72
78
|
|
73
79
|
|
74
80
|
#ifdef RUBY_INTERNAL_EVENT_NEWOBJ
|
@@ -403,7 +409,7 @@ static VALUE rb_scout_profile_frames(VALUE self)
|
|
403
409
|
if (_traces[i].num_tracelines > 0) {
|
404
410
|
trace = rb_ary_new2(_traces[i].num_tracelines);
|
405
411
|
for(n = 0; n < _traces[i].num_tracelines; n++) {
|
406
|
-
if (TYPE(_traces[i].frames_buf[n]) ==
|
412
|
+
if (TYPE(_traces[i].frames_buf[n]) == VALID_RUBY_FRAME) { // We should always get valid frames from rb_profile_frames, but that doesn't always seem to be the case
|
407
413
|
trace_line = rb_ary_new2(2);
|
408
414
|
rb_ary_store(trace_line, 0, _traces[i].frames_buf[n]);
|
409
415
|
rb_ary_store(trace_line, 1, INT2FIX(_traces[i].lines_buf[n]));
|
data/lib/scout_apm.rb
CHANGED
@@ -165,6 +165,8 @@ if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR
|
|
165
165
|
end
|
166
166
|
class Railtie < Rails::Railtie
|
167
167
|
initializer 'scout_apm.start' do |app|
|
168
|
+
# Install the middleware every time in development mode.
|
169
|
+
# The middleware is a noop if dev_trace is not enabled in config
|
168
170
|
if Rails.env.development?
|
169
171
|
app.middleware.use ScoutApm::Instant::Middleware
|
170
172
|
end
|
data/lib/scout_apm/agent.rb
CHANGED
@@ -112,7 +112,10 @@ module ScoutApm
|
|
112
112
|
# It initializes the agent and starts the worker thread (if appropiate).
|
113
113
|
def start(options = {})
|
114
114
|
@options.merge!(options)
|
115
|
+
|
115
116
|
@config = ScoutApm::Config.with_file(@config.value("config_file"))
|
117
|
+
layaway.config = config
|
118
|
+
|
116
119
|
init_logger
|
117
120
|
logger.info "Attempting to start Scout Agent [#{ScoutApm::VERSION}] on [#{environment.hostname}]"
|
118
121
|
|
@@ -41,8 +41,7 @@ module ScoutApm
|
|
41
41
|
# Note that this middleware never even gets inserted unless Rails environment is development (See Railtie)
|
42
42
|
class Middleware
|
43
43
|
def initialize(app)
|
44
|
-
|
45
|
-
@app = app
|
44
|
+
@app = app
|
46
45
|
end
|
47
46
|
|
48
47
|
def call(env)
|
data/lib/scout_apm/layaway.rb
CHANGED
data/lib/scout_apm/store.rb
CHANGED
@@ -69,14 +69,19 @@ module ScoutApm
|
|
69
69
|
|
70
70
|
@mutex.synchronize {
|
71
71
|
reporting_periods.select { |time, rp| force || time.timestamp < current_timestamp.timestamp}.
|
72
|
-
each { |time, rp|
|
73
|
-
collect_samplers(rp)
|
74
|
-
layaway.write_reporting_period(rp)
|
75
|
-
reporting_periods.delete(time)
|
76
|
-
}
|
72
|
+
each { |time, rp| write_reporting_period(layaway, time, rp) }
|
77
73
|
}
|
78
74
|
end
|
79
75
|
|
76
|
+
def write_reporting_period(layaway, time, rp)
|
77
|
+
collect_samplers(rp)
|
78
|
+
layaway.write_reporting_period(rp)
|
79
|
+
rescue => e
|
80
|
+
ScoutApm::Agent.instance.logger.warn("Failed writing data to layaway file: #{e.message} / #{e.backtrace}")
|
81
|
+
ensure
|
82
|
+
reporting_periods.delete(time)
|
83
|
+
end
|
84
|
+
|
80
85
|
######################################
|
81
86
|
# Sampler support
|
82
87
|
def add_sampler(sampler)
|
data/lib/scout_apm/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'scout_apm/store'
|
4
|
+
|
5
|
+
class FakeFailingLayaway
|
6
|
+
def write_reporting_period(rp)
|
7
|
+
raise "Always fails. Sucks."
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class StoreTest < Minitest::Test
|
12
|
+
# TODO: Introduce a clock object to avoid having to use 'force'
|
13
|
+
def test_writing_layaway_removes_timestamps
|
14
|
+
s = ScoutApm::Store.new
|
15
|
+
s.track_one!("Controller", "user/show", 10)
|
16
|
+
|
17
|
+
assert_equal(1, s.reporting_periods.size)
|
18
|
+
|
19
|
+
s.write_to_layaway(FakeFailingLayaway.new, true)
|
20
|
+
|
21
|
+
assert_equal({}, s.reporting_periods)
|
22
|
+
end
|
23
|
+
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: 2.2.0.
|
4
|
+
version: 2.2.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-08-
|
12
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rusage
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- test/unit/slow_job_policy_test.rb
|
242
242
|
- test/unit/slow_request_policy_test.rb
|
243
243
|
- test/unit/sql_sanitizer_test.rb
|
244
|
+
- test/unit/store_test.rb
|
244
245
|
- test/unit/utils/active_record_metric_name_test.rb
|
245
246
|
- test/unit/utils/backtrace_parser_test.rb
|
246
247
|
- tester.rb
|