atatus 1.0.2 → 1.1.0
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.md +8 -0
- data/lib/atatus/collector/base.rb +51 -11
- data/lib/atatus/collector/builder.rb +43 -22
- data/lib/atatus/collector/transport.rb +5 -1
- data/lib/atatus/config.rb +1 -1
- data/lib/atatus/span.rb +1 -1
- data/lib/atatus/stacktrace_builder.rb +11 -7
- data/lib/atatus/transaction.rb +1 -1
- data/lib/atatus/util.rb +4 -0
- data/lib/atatus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19bb396dacbaf9a052b4b3d35b31dac1e696a8f511147b1aaadc54a43bceccbc
|
4
|
+
data.tar.gz: e39e3ee409263c6705f19d22b643297d6447fbf761957d6d528104bfe571e608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1215f5b881147e211257ff53eb61c2f2a6a9acde21cc1a2b4a4b5ac80d77b5b1661c70ef7997f426537732578439106b05c806dec366b3a472dff34a9d4cab9
|
7
|
+
data.tar.gz: 1368782a8b6e6f58a729853cbc0f4e26acc68713a19da41f4be3db66ea1dbb6b47e4faf03b3fd5a73962a27b74683963fb145ba7dfb157e5488085e0601962ec
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 1.1.0 (Thu, 5 Dec 2019)
|
8
|
+
|
9
|
+
- Added HTTP context for External Requests in traces.
|
10
|
+
- Added layer duration for Ruby code.
|
11
|
+
- Fixed time calculations in database calls where min, average calculation was incorrect.
|
12
|
+
- Removed stacktrace frame for libraries.
|
13
|
+
|
14
|
+
|
7
15
|
## 1.0.2 (Thu, 21 Nov 2019)
|
8
16
|
|
9
17
|
- Changed Linux memory size to bytes.
|
@@ -5,6 +5,8 @@ require 'atatus/transaction'
|
|
5
5
|
require 'atatus/collector/layer'
|
6
6
|
require 'atatus/collector/transport'
|
7
7
|
|
8
|
+
SpanTiming = Struct.new(:start, :end)
|
9
|
+
|
8
10
|
module Atatus
|
9
11
|
module Collector
|
10
12
|
class Txn < Layer
|
@@ -135,12 +137,14 @@ module Atatus
|
|
135
137
|
if
|
136
138
|
txn.name.nil? ||
|
137
139
|
txn.id.nil? ||
|
140
|
+
txn.timestamp.nil? ||
|
138
141
|
txn.duration.nil?
|
139
142
|
then
|
140
143
|
return
|
141
144
|
end
|
142
145
|
|
143
146
|
return if txn.name.empty?
|
147
|
+
return if txn.duration <= 0
|
144
148
|
|
145
149
|
@txns_lock.synchronize do
|
146
150
|
if !@txns_agg.key?(txn.name)
|
@@ -152,12 +156,16 @@ module Atatus
|
|
152
156
|
end
|
153
157
|
|
154
158
|
spans_present = false
|
159
|
+
ruby_time = 0
|
160
|
+
spans_tuple = []
|
155
161
|
if @spans.key?(txn.id)
|
162
|
+
spans_present = true
|
156
163
|
@spans[txn.id].each do |span|
|
157
164
|
if
|
158
165
|
span.name.nil? ||
|
159
166
|
span.type.nil? ||
|
160
167
|
span.subtype.nil? ||
|
168
|
+
span.timestamp.nil? ||
|
161
169
|
span.duration.nil?
|
162
170
|
then
|
163
171
|
next
|
@@ -165,23 +173,55 @@ module Atatus
|
|
165
173
|
|
166
174
|
next if span.name.empty?
|
167
175
|
|
168
|
-
if
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
176
|
+
if span.timestamp >= txn.timestamp
|
177
|
+
start = Util.ms(span.timestamp - txn.timestamp)
|
178
|
+
spans_tuple.push(SpanTiming.new(start, start + Util.ms(span.duration)))
|
179
|
+
if !@txns_agg[txn.name].spans.key?(span.name)
|
180
|
+
kind = Layer.span_kind(span.type)
|
181
|
+
type = Layer.span_type(span.subtype)
|
182
|
+
@txns_agg[txn.name].spans[span.name] = Layer.new(type, kind, span.duration)
|
183
|
+
@txns_agg[txn.name].spans[span.name].id = span.id
|
184
|
+
@txns_agg[txn.name].spans[span.name].pid = span.transaction_id
|
185
|
+
else
|
186
|
+
@txns_agg[txn.name].spans[span.name].aggregate! span.duration
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
if spans_tuple.length == 0
|
193
|
+
ruby_time = Util.ms(txn.duration)
|
194
|
+
else
|
195
|
+
spans_tuple.sort! {| a, b | a[:start] <=> b[:start] }
|
196
|
+
ruby_time = spans_tuple[0].start
|
197
|
+
span_end = spans_tuple[0].end
|
198
|
+
j = 0
|
199
|
+
while j < spans_tuple.length
|
200
|
+
if spans_tuple[j].start > span_end
|
201
|
+
ruby_time += spans_tuple[j].start - span_end
|
202
|
+
span_end = spans_tuple[j].end
|
174
203
|
else
|
175
|
-
|
204
|
+
if spans_tuple[j].end > span_end
|
205
|
+
span_end = spans_tuple[j].end
|
206
|
+
end
|
176
207
|
end
|
177
|
-
|
208
|
+
j += 1
|
209
|
+
end
|
210
|
+
if Util.ms(txn.duration) > span_end
|
211
|
+
ruby_time += Util.ms(txn.duration) - span_end
|
178
212
|
end
|
179
213
|
end
|
180
214
|
|
181
|
-
if
|
215
|
+
if ruby_time > 0
|
216
|
+
ruby_time = Util.us(ruby_time)
|
217
|
+
@txns_agg[txn.name].spans["Ruby"] = Layer.new("Ruby", "Ruby", ruby_time)
|
218
|
+
end
|
219
|
+
|
220
|
+
if spans_present == true || ruby_time > 0
|
182
221
|
if Util.ms(txn.duration) >= @config.trace_threshold
|
183
222
|
trace_txn = txn
|
184
|
-
trace_txn.spans = @spans[txn.id]
|
223
|
+
trace_txn.spans = @spans[txn.id] if spans_present
|
224
|
+
trace_txn.ruby_time = ruby_time if ruby_time > 0
|
185
225
|
|
186
226
|
if @traces_agg.length < 5
|
187
227
|
@traces_agg.push(trace_txn)
|
@@ -266,7 +306,7 @@ module Atatus
|
|
266
306
|
@collect_counter += 1
|
267
307
|
|
268
308
|
end_time = (Time.now.to_f * 1000).to_i
|
269
|
-
debug '%s:
|
309
|
+
debug '%s: data collector', pid_str
|
270
310
|
|
271
311
|
txns_data = nil
|
272
312
|
traces_data = nil
|
@@ -139,7 +139,7 @@ module Atatus
|
|
139
139
|
name: name,
|
140
140
|
type: value.type,
|
141
141
|
kind: value.kind,
|
142
|
-
durations: [value.count, Util.ms(value.
|
142
|
+
durations: [value.count, Util.ms(value.total), Util.ms(value.min), Util.ms(value.max)]
|
143
143
|
}
|
144
144
|
end
|
145
145
|
|
@@ -249,6 +249,27 @@ module Atatus
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
+
if
|
253
|
+
!txn.ruby_time.nil?
|
254
|
+
then
|
255
|
+
entry = {}
|
256
|
+
entry[:lv] = 1
|
257
|
+
entry[:so] = 0
|
258
|
+
entry[:du] = Util.ms(txn.ruby_time)
|
259
|
+
entry[:ly] = {}
|
260
|
+
entry[:ly][:name] = AGENT_NAME
|
261
|
+
entry[:ly][:type] = AGENT_NAME
|
262
|
+
entry[:ly][:kind] = AGENT_NAME
|
263
|
+
trace[:entries] << entry
|
264
|
+
func_index = trace[:funcs].index(AGENT_NAME)
|
265
|
+
if func_index.nil?
|
266
|
+
trace[:funcs] << AGENT_NAME
|
267
|
+
func_index = i
|
268
|
+
i = i + 1
|
269
|
+
end
|
270
|
+
entry[:i] = func_index
|
271
|
+
end
|
272
|
+
|
252
273
|
traces << trace
|
253
274
|
end
|
254
275
|
traces
|
@@ -341,30 +362,30 @@ module Atatus
|
|
341
362
|
frame[:ln] = f.lineno
|
342
363
|
if f.library_frame == false
|
343
364
|
frame[:inp] = true
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
f.pre_context.each do |c|
|
354
|
-
frame[:code].push([lineno.to_s, c])
|
355
|
-
lineno += 1
|
356
|
-
end
|
365
|
+
end
|
366
|
+
if !f.context_line.nil?
|
367
|
+
frame[:code] = []
|
368
|
+
|
369
|
+
if f.library_frame == false && !f.pre_context.nil?
|
370
|
+
psize = f.pre_context.size
|
371
|
+
lineno = 0
|
372
|
+
if f.lineno - psize >= 0
|
373
|
+
lineno = f.lineno - psize
|
357
374
|
end
|
375
|
+
f.pre_context.each do |c|
|
376
|
+
frame[:code].push([lineno.to_s, c])
|
377
|
+
lineno += 1
|
378
|
+
end
|
379
|
+
end
|
358
380
|
|
359
|
-
|
381
|
+
frame[:code].push([f.lineno.to_s, f.context_line])
|
360
382
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
end
|
383
|
+
if f.library_frame == false && !f.post_context.nil?
|
384
|
+
psize = f.post_context.size
|
385
|
+
lineno = f.lineno + 1
|
386
|
+
f.post_context.each do |c|
|
387
|
+
frame[:code].push([lineno.to_s, c])
|
388
|
+
lineno += 1
|
368
389
|
end
|
369
390
|
end
|
370
391
|
end
|
@@ -104,7 +104,11 @@ module Atatus
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
|
107
|
+
if !resp
|
108
|
+
error format('Atatus transport status 400, failed with parsed content: %s', resp)
|
109
|
+
else
|
110
|
+
error format('Atatus transport status 400, failed with content: %s', response.body)
|
111
|
+
end
|
108
112
|
else
|
109
113
|
end
|
110
114
|
end
|
data/lib/atatus/config.rb
CHANGED
@@ -70,7 +70,7 @@ module Atatus
|
|
70
70
|
option :service_version, type: :string
|
71
71
|
option :source_lines_error_app_frames, type: :int, default: 5
|
72
72
|
option :source_lines_error_library_frames, type: :int, default: 0
|
73
|
-
option :source_lines_span_app_frames, type: :int, default:
|
73
|
+
option :source_lines_span_app_frames, type: :int, default: 0
|
74
74
|
option :source_lines_span_library_frames, type: :int, default: 0
|
75
75
|
option :span_frames_min_duration, type: :float, default: '5ms', converter: Duration.new(default_unit: 'ms')
|
76
76
|
option :stack_trace_limit, type: :int, default: 999_999
|
data/lib/atatus/span.rb
CHANGED
@@ -38,7 +38,7 @@ module Atatus
|
|
38
38
|
|
39
39
|
frame = Stacktrace::Frame.new
|
40
40
|
frame.abs_path = abs_path
|
41
|
-
frame.filename = strip_load_path(abs_path)
|
41
|
+
frame.filename = strip_load_path(config, abs_path)
|
42
42
|
frame.function = function
|
43
43
|
frame.lineno = lineno.to_i
|
44
44
|
frame.library_frame = library_frame?(config, abs_path)
|
@@ -84,14 +84,18 @@ module Atatus
|
|
84
84
|
end
|
85
85
|
# rubocop:enable Metrics/CyclomaticComplexity
|
86
86
|
|
87
|
-
def strip_load_path(path)
|
87
|
+
def strip_load_path(config, path)
|
88
88
|
return nil if path.nil?
|
89
89
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
if path.start_with?(config.__root_path)
|
91
|
+
prefix = config.__root_path
|
92
|
+
else
|
93
|
+
prefix =
|
94
|
+
$LOAD_PATH
|
95
|
+
.map(&:to_s)
|
96
|
+
.select { |s| path.start_with?(s) }
|
97
|
+
.max_by(&:length)
|
98
|
+
end
|
95
99
|
|
96
100
|
prefix ? path[prefix.chomp(File::SEPARATOR).length + 1..-1] : path
|
97
101
|
end
|
data/lib/atatus/transaction.rb
CHANGED
@@ -39,7 +39,7 @@ module Atatus
|
|
39
39
|
end
|
40
40
|
# rubocop:enable Metrics/ParameterLists
|
41
41
|
|
42
|
-
attr_accessor :name, :type, :result, :spans
|
42
|
+
attr_accessor :name, :type, :result, :spans, :ruby_time
|
43
43
|
|
44
44
|
attr_reader :context, :duration, :started_spans, :dropped_spans,
|
45
45
|
:timestamp, :trace_context, :notifications
|
data/lib/atatus/util.rb
CHANGED
data/lib/atatus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atatus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atatus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|