scout_apm 1.2.0.pre1 → 1.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/lib/scout_apm.rb +1 -0
- data/lib/scout_apm/layaway.rb +5 -2
- data/lib/scout_apm/request_manager.rb +2 -0
- data/lib/scout_apm/store.rb +14 -7
- data/lib/scout_apm/tracked_request.rb +1 -0
- data/lib/scout_apm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d6c0d1a7b075d83263b5dff40c8fbe2b4eab1fc
|
4
|
+
data.tar.gz: 5f73ca06343930f4bf382db202354ab7acaf12a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01dced334f85cb89959a6cbd382ca46379d92294c0d559dabb30863db505ed2118e040eb96dd5e9d7266448dd491976f0e6639ac2727ca10edc0592cf6bb68cc
|
7
|
+
data.tar.gz: 9fadb1d142476b67db70d32d8e49446df6a3092aa6458d2606560f8e732ee441b753e428cce9693bf3287a6aeef37aca8c93d54529241f6529c324c9e6c3f6f3
|
data/lib/scout_apm.rb
CHANGED
data/lib/scout_apm/layaway.rb
CHANGED
@@ -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
|
30
|
-
old_val.
|
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
|
data/lib/scout_apm/store.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
|
data/lib/scout_apm/version.rb
CHANGED