scout_apm 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8028449405090925eb88ee0254ad5701121d100
4
- data.tar.gz: 54e43b9958363ed353e710a73d157e0354968bf2
3
+ metadata.gz: dab9d1dfbd7c814de188768159109981c7100a54
4
+ data.tar.gz: 85d434f1c0c82b3cb19d3ad72fc3c04de45ad958
5
5
  SHA512:
6
- metadata.gz: a7c93db879549d9e7a21cae4b0da7d039c8f84c4b0ff6d780504136c3926398d898b8db96497e4dfa332b1932c7607edb152da9ebdb3931c70345d650364a205
7
- data.tar.gz: 78b5548d07db590a0a9bd9ef9ea55c4751e10a708d709e02001f996f00cb65960200cb6915148b21097fee77a7f440eb087871ef9fc0966300f077dc30bda87b
6
+ metadata.gz: 45d7d02378d1d103bc55067e67a0c13e3ea16d86bc790bddd8577b6b2ca70ff1d5ece8e01894a1995a40f2ef009b94149a9bd0b7b65443d27894114190fca1d9
7
+ data.tar.gz: cce129502472b05706abec00715bda69543049fdadf227f69cd2a5dd7626872a1a6ec86890f4ae400fe74ac3239c5d18da422264f2dfd0d2c2200a77cd4a937d
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.1
2
+
3
+ * Store the start time of slow requests.
4
+
1
5
  # 0.1.0
2
6
 
3
7
  * Boom.
@@ -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.
@@ -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}" end
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
 
@@ -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!
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "0.1"
2
+ VERSION = "0.1.1"
3
3
  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: '0.1'
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-22 00:00:00.000000000 Z
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.4.6
73
+ rubygems_version: 2.2.2
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Ruby application performance monitoring