scout_apm 1.5.0.pre → 1.5.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/scout_apm/layer_converters/slow_job_converter.rb +27 -2
- data/lib/scout_apm/layer_converters/slow_request_converter.rb +9 -4
- data/lib/scout_apm/serializers/metrics_to_json_serializer.rb +0 -1
- data/lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb +1 -1
- data/lib/scout_apm/version.rb +1 -1
- data/scout_apm.gemspec +1 -0
- data/test/test_helper.rb +4 -2
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62d8acd6b57cf347630cbdd43dcea3ff0fd04769
|
4
|
+
data.tar.gz: a3cefdd503a1e87ed55469084a0906d02611c745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 09c3d488fc83ebbedcf9b5e0b543945459f5b3ab44ad1a5c92fe37165e732e92f0b691d4d203567a058805bcb636099e8987b57b1d697bc5d15b43908b36e3d3
|
7
|
+
data.tar.gz: ff962282beaff96d28866bb1fe00c811a09e87676a452d549858dbec63f67e1afa0eb6842c661d1ea8e1995903df05bb406510e3c049c060d813d0b8b20e7953
|
data/.gitignore
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
module ScoutApm
|
2
2
|
module LayerConverters
|
3
3
|
class SlowJobConverter < ConverterBase
|
4
|
+
def initialize(*)
|
5
|
+
@backtraces = []
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
4
9
|
def call
|
5
10
|
return unless request.job?
|
6
11
|
|
@@ -68,8 +73,18 @@ module ScoutApm
|
|
68
73
|
# Specific Metric
|
69
74
|
meta_options.merge!(:desc => layer.desc.to_s) if layer.desc
|
70
75
|
meta = MetricMeta.new(layer.legacy_metric_name, meta_options)
|
71
|
-
|
72
|
-
|
76
|
+
if layer.backtrace
|
77
|
+
bt = ScoutApm::Utils::BacktraceParser.new(layer.backtrace).call
|
78
|
+
if bt.any? # we could walk thru the call stack and not find in-app code
|
79
|
+
meta.backtrace = bt
|
80
|
+
# Why not just call meta.backtrace and call it done? The walker could access a later later that generates the same MetricMeta but doesn't have a backtrace. This could be
|
81
|
+
# lost in the metric_hash if it is replaced by the new key.
|
82
|
+
@backtraces << meta
|
83
|
+
else
|
84
|
+
ScoutApm::Agent.instance.logger.debug { "Unable to capture an app-specific backtrace for #{meta.inspect}\n#{layer.backtrace}" }
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
73
88
|
metric_hash[meta] ||= MetricStats.new( meta_options.has_key?(:scope) )
|
74
89
|
stat = metric_hash[meta]
|
75
90
|
stat.update!(layer.total_call_time, layer.total_exclusive_time)
|
@@ -81,6 +96,16 @@ module ScoutApm
|
|
81
96
|
stat.update!(layer.total_call_time, layer.total_exclusive_time)
|
82
97
|
end
|
83
98
|
|
99
|
+
metric_hash = attach_backtraces(metric_hash)
|
100
|
+
|
101
|
+
metric_hash
|
102
|
+
end
|
103
|
+
|
104
|
+
def attach_backtraces(metric_hash)
|
105
|
+
ScoutApm::Agent.instance.logger.info("Attaching backtraces to job #{@backtraces}")
|
106
|
+
@backtraces.each do |meta_with_backtrace|
|
107
|
+
metric_hash.keys.find { |k| k == meta_with_backtrace }.backtrace = meta_with_backtrace.backtrace
|
108
|
+
end
|
84
109
|
metric_hash
|
85
110
|
end
|
86
111
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module ScoutApm
|
2
2
|
module LayerConverters
|
3
3
|
class SlowRequestConverter < ConverterBase
|
4
|
+
def initialize(*)
|
5
|
+
@backtraces = [] # An Array of MetricMetas that have a backtrace
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
4
9
|
def call
|
5
10
|
scope = scope_layer
|
6
11
|
return [nil, {}] unless scope
|
@@ -15,8 +20,6 @@ module ScoutApm
|
|
15
20
|
stat = MetricStats.new
|
16
21
|
stat.update!(1)
|
17
22
|
|
18
|
-
@backtraces = [] # An Array of MetricMetas that have a backtrace
|
19
|
-
|
20
23
|
uri = request.annotations[:uri] || ""
|
21
24
|
|
22
25
|
metrics = create_metrics
|
@@ -84,8 +87,10 @@ module ScoutApm
|
|
84
87
|
bt = ScoutApm::Utils::BacktraceParser.new(layer.backtrace).call
|
85
88
|
if bt.any? # we could walk thru the call stack and not find in-app code
|
86
89
|
meta.backtrace = bt
|
87
|
-
# Why not just call meta.backtrace and call it done? The walker
|
88
|
-
#
|
90
|
+
# Why not just call meta.backtrace and call it done? The walker
|
91
|
+
# could access a later later that generates the same MetricMeta
|
92
|
+
# but doesn't have a backtrace. This could be lost in the
|
93
|
+
# metric_hash if it is replaced by the new key.
|
89
94
|
@backtraces << meta
|
90
95
|
else
|
91
96
|
ScoutApm::Agent.instance.logger.debug { "Unable to capture an app-specific backtrace for #{meta.inspect}\n#{layer.backtrace}" }
|
@@ -16,7 +16,6 @@ module ScoutApm
|
|
16
16
|
# Supports only a single-level nesting, until we have redone metric
|
17
17
|
# classes, instead of Meta and Stats
|
18
18
|
def metric_as_json(meta, stat, child_metrics={})
|
19
|
-
|
20
19
|
{ "bucket" => meta.type,
|
21
20
|
"name" => meta.name, # No scope values needed here, since it's implied by the nesting.
|
22
21
|
|
data/lib/scout_apm/version.rb
CHANGED
data/scout_apm.gemspec
CHANGED
data/test/test_helper.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.0.
|
4
|
+
version: 1.5.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-04-
|
12
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: simplecov
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
56
70
|
description: Monitors Ruby apps and reports detailed metrics on performance to Scout.
|
57
71
|
email:
|
58
72
|
- support@scoutapp.com
|