scout_apm 0.1 → 0.1.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/lib/scout_apm/slow_transaction.rb +3 -2
- data/lib/scout_apm/store.rb +3 -2
- data/lib/scout_apm/tracer.rb +3 -0
- data/lib/scout_apm/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab9d1dfbd7c814de188768159109981c7100a54
|
4
|
+
data.tar.gz: 85d434f1c0c82b3cb19d3ad72fc3c04de45ad958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45d7d02378d1d103bc55067e67a0c13e3ea16d86bc790bddd8577b6b2ca70ff1d5ece8e01894a1995a40f2ef009b94149a9bd0b7b65443d27894114190fca1d9
|
7
|
+
data.tar.gz: cce129502472b05706abec00715bda69543049fdadf227f69cd2a5dd7626872a1a6ec86890f4ae400fe74ac3239c5d18da422264f2dfd0d2c2200a77cd4a937d
|
data/CHANGELOG.markdown
CHANGED
@@ -2,7 +2,7 @@ class ScoutApm::SlowTransaction
|
|
2
2
|
BACKTRACE_THRESHOLD = 0.5 # the minimum threshold to record the backtrace for a metric.
|
3
3
|
BACKTRACE_LIMIT = 5 # Max length of callers to display
|
4
4
|
MAX_SIZE = 100 # Limits the size of the metric hash to prevent a metric explosion.
|
5
|
-
attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri, :context
|
5
|
+
attr_reader :metric_name, :total_call_time, :metrics, :meta, :uri, :context, :time
|
6
6
|
|
7
7
|
# Given a call stack, generates a filtered backtrace that:
|
8
8
|
# * Limits to the app/models, app/controllers, or app/views directories
|
@@ -19,12 +19,13 @@ class ScoutApm::SlowTransaction
|
|
19
19
|
stack
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize(uri,metric_name,total_call_time,metrics,context)
|
22
|
+
def initialize(uri,metric_name,total_call_time,metrics,context,time)
|
23
23
|
@uri = uri
|
24
24
|
@metric_name = metric_name
|
25
25
|
@total_call_time = total_call_time
|
26
26
|
@metrics = metrics
|
27
27
|
@context = context
|
28
|
+
@time = time
|
28
29
|
end
|
29
30
|
|
30
31
|
# Used to remove metrics when the payload will be too large.
|
data/lib/scout_apm/store.rb
CHANGED
@@ -137,8 +137,9 @@ class ScoutApm::Store
|
|
137
137
|
@slow_transaction_lock.synchronize do
|
138
138
|
# tree map of all slow transactions
|
139
139
|
if parent_stat.total_call_time >= 2
|
140
|
-
@slow_transactions.push(ScoutApm::SlowTransaction.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup,ScoutApm::Context.current))
|
141
|
-
ScoutApm::Agent.instance.logger.debug "Slow transaction sample added. [URI: #{uri}] [Context: #{ScoutApm::Context.current.to_hash}] Array Size: #{@slow_transactions.size}"
|
140
|
+
@slow_transactions.push(ScoutApm::SlowTransaction.new(uri,parent_meta.metric_name,parent_stat.total_call_time,transaction_hash.dup,ScoutApm::Context.current,Thread::current[:scout_apm_trace_time]))
|
141
|
+
ScoutApm::Agent.instance.logger.debug "Slow transaction sample added. [URI: #{uri}] [Context: #{ScoutApm::Context.current.to_hash}] Array Size: #{@slow_transactions.size}"
|
142
|
+
end
|
142
143
|
end
|
143
144
|
end
|
144
145
|
|
data/lib/scout_apm/tracer.rb
CHANGED
@@ -18,13 +18,16 @@ module ScoutApm::Tracer
|
|
18
18
|
# * uri - the request uri
|
19
19
|
# * ip - the remote ip of the user. This is merged into the User context.
|
20
20
|
def scout_apm_trace(metric_name, options = {}, &block)
|
21
|
+
# TODO - wrap a lot of this into a Trace class, store that as a Thread var.
|
21
22
|
ScoutApm::Agent.instance.store.reset_transaction!
|
22
23
|
ScoutApm::Context.current.add_user(:ip => options[:ip]) if options[:ip]
|
24
|
+
Thread::current[:scout_apm_trace_time] = Time.now.utc
|
23
25
|
instrument(metric_name, options) do
|
24
26
|
Thread::current[:scout_apm_scope_name] = metric_name
|
25
27
|
yield
|
26
28
|
Thread::current[:scout_apm_scope_name] = nil
|
27
29
|
end
|
30
|
+
Thread::current[:scout_apm_trace_time] = nil
|
28
31
|
# The context is cleared after instrumentation (rather than before) as tracing controller-actions doesn't occur until the controller-action is called.
|
29
32
|
# It does not trace before filters, which is a likely spot to add context. This means that any context applied during before_filters would be cleared.
|
30
33
|
ScoutApm::Context.clear!
|
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:
|
4
|
+
version: 0.1.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: 2015-07-
|
12
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Monitors Ruby apps and reports detailed metrics on performance to Scout.
|
15
15
|
email:
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project: scout_apm
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.2.2
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Ruby application performance monitoring
|