scout_apm 1.2.0.pre1 → 1.2.0.pre2

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: 908063c42f604e0073f59f50d2fab04966553a20
4
- data.tar.gz: 0bc50d1533419d27d62ca3692472d08e764536f7
3
+ metadata.gz: 7d6c0d1a7b075d83263b5dff40c8fbe2b4eab1fc
4
+ data.tar.gz: 5f73ca06343930f4bf382db202354ab7acaf12a8
5
5
  SHA512:
6
- metadata.gz: f72beb94361832f4cd64faf3e618a83bef3989232ee68deb16472508ec82ef58b2cfea0973f95225d57b68c995a0724ded878acfa424c0c30b90f4b2d3cb63c0
7
- data.tar.gz: 4dca8b6565dac5f29abe8deafa353da9512a5508981098e096b7cafb47585391cd77f8cb58a1f5c8a7e04250ff339e82d9c34d726af91d195b17bd2b11325ea0
6
+ metadata.gz: 01dced334f85cb89959a6cbd382ca46379d92294c0d559dabb30863db505ed2118e040eb96dd5e9d7266448dd491976f0e6639ac2727ca10edc0592cf6bb68cc
7
+ data.tar.gz: 9fadb1d142476b67db70d32d8e49446df6a3092aa6458d2606560f8e732ee441b753e428cce9693bf3287a6aeef37aca8c93d54529241f6529c324c9e6c3f6f3
data/lib/scout_apm.rb CHANGED
@@ -8,6 +8,7 @@ require 'cgi'
8
8
  require 'logger'
9
9
  require 'net/http'
10
10
  require 'openssl'
11
+ require 'pp'
11
12
  require 'set'
12
13
  require 'socket'
13
14
  require 'thread'
@@ -26,8 +26,11 @@ module ScoutApm
26
26
  def add_reporting_period(time, reporting_period)
27
27
  file.read_and_write do |existing_data|
28
28
  existing_data ||= Hash.new
29
- existing_data.merge!(time => reporting_period) {|key, old_val, new_val|
30
- old_val.merge_metrics!(new_val.metrics).merge_slow_transactions!(new_val.slow_transactions)
29
+ existing_data.merge(time => reporting_period) {|key, old_val, new_val|
30
+ ScoutApm::Agent.instance.logger.debug("Merging Layaway - Time: #{key.to_s}, OldMetrics: #{old_val.metrics.length}, OldSlowTrans: #{old_val.slow_transactions.length}, NewMetrics: #{new_val.metrics.length}, NewSlowTrans: #{new_val.slow_transactions.length}" )
31
+ result = old_val.merge_metrics!(new_val.metrics).merge_slow_transactions!(new_val.slow_transactions)
32
+ ScoutApm::Agent.instance.logger.debug("Result - Metrics: #{result.metrics.length}, SlowTrans: #{result.slow_transactions.length}" )
33
+ result
31
34
  }
32
35
  end
33
36
  end
@@ -14,12 +14,14 @@ module ScoutApm
14
14
  if req && req.recorded?
15
15
  nil
16
16
  else
17
+ ScoutApm::Agent.instance.logger.info("Found Existing Request")
17
18
  req
18
19
  end
19
20
  end
20
21
 
21
22
  # Create a new TrackedRequest object for this thread
22
23
  def self.create
24
+ ScoutApm::Agent.instance.logger.info("Starting a new Request")
23
25
  Thread.current[:scout_request] = TrackedRequest.new
24
26
  end
25
27
  end
@@ -7,6 +7,7 @@ module ScoutApm
7
7
  attr_reader :reporting_periods
8
8
 
9
9
  def initialize
10
+ @mutex = Mutex.new
10
11
  @reporting_periods = Hash.new { |h,k| h[k] = StoreReportingPeriod.new(k) }
11
12
  end
12
13
 
@@ -16,7 +17,9 @@ module ScoutApm
16
17
 
17
18
  # Save newly collected metrics
18
19
  def track!(metrics, options={})
19
- reporting_periods[current_timestamp].merge_metrics!(metrics)
20
+ @mutex.synchronize {
21
+ reporting_periods[current_timestamp].merge_metrics!(metrics)
22
+ }
20
23
  end
21
24
 
22
25
  def track_one!(type, name, value, options={})
@@ -28,16 +31,20 @@ module ScoutApm
28
31
 
29
32
  # Save a new slow transaction
30
33
  def track_slow_transaction!(slow_transaction)
31
- reporting_periods[current_timestamp].merge_slow_transactions!(slow_transaction)
34
+ @mutex.synchronize {
35
+ reporting_periods[current_timestamp].merge_slow_transactions!(slow_transaction)
36
+ }
32
37
  end
33
38
 
34
39
  # Take each completed reporting_period, and write it to the layaway passed
35
40
  def write_to_layaway(layaway)
36
- reporting_periods.select { |time, rp| time.timestamp < current_timestamp.timestamp}.
37
- each { |time, reporting_period|
38
- layaway.add_reporting_period(time, reporting_period)
39
- reporting_periods.delete(time)
40
- }
41
+ @mutex.synchronize {
42
+ reporting_periods.select { |time, rp| time.timestamp < current_timestamp.timestamp}.
43
+ each { |time, reporting_period|
44
+ layaway.add_reporting_period(time, reporting_period)
45
+ reporting_periods.delete(time)
46
+ }
47
+ }
41
48
  end
42
49
  end
43
50
 
@@ -85,6 +85,7 @@ module ScoutApm
85
85
  # * Collect stackprof info
86
86
  # * Send the request off to be stored
87
87
  def stop_request
88
+ ScoutApm::Agent.instance.logger.debug("stop_request: #{annotations[:uri]}" )
88
89
  StackProf.stop
89
90
  @stackprof = StackProf.results
90
91
 
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "1.2.0.pre1"
2
+ VERSION = "1.2.0.pre2"
3
3
  end
4
4
 
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.2.0.pre1
4
+ version: 1.2.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes