lightstep 0.10.3 → 0.10.5
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/lightstep/reporter.rb +8 -24
- data/lib/lightstep/span.rb +4 -3
- data/lib/lightstep/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8093579b2f9408a1ef5e89c3c441afed0a0bf6bf
|
4
|
+
data.tar.gz: 23ddf77975e6afcb3d45a082e21758b52c970b82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e985656f8072f3b35d21a74bfd6bde7d908bbef59478cda5d579306f4cc9d3803a99e82308517bd7cc3720d7fef349bb338a1c91b918cb5431ca4c32110eacc
|
7
|
+
data.tar.gz: 6e47a0c1f14ff30a382549f255050e0f3ac6a629ca879d5cbf4f3bb501a5e173016cd1d26ec7bff79e1bc5305801a32188b2ea4b632c75ad67edcfde740939d6
|
data/lib/lightstep/reporter.rb
CHANGED
@@ -11,7 +11,6 @@ module LightStep
|
|
11
11
|
@max_span_records = max_span_records
|
12
12
|
@span_records = Concurrent::Array.new
|
13
13
|
@dropped_spans = Concurrent::AtomicFixnum.new
|
14
|
-
@dropped_span_logs = Concurrent::AtomicFixnum.new
|
15
14
|
@transport = transport
|
16
15
|
@period = DEFAULT_PERIOD_SECONDS
|
17
16
|
|
@@ -37,9 +36,8 @@ module LightStep
|
|
37
36
|
|
38
37
|
@span_records.push(span.to_h)
|
39
38
|
if @span_records.size > max_span_records
|
40
|
-
|
39
|
+
@span_records.shift
|
41
40
|
@dropped_spans.increment
|
42
|
-
@dropped_span_logs.increment(dropped[:log_records].size + dropped[:dropped_logs])
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
@@ -48,11 +46,6 @@ module LightStep
|
|
48
46
|
|
49
47
|
span_records = @span_records.slice!(0, @span_records.length)
|
50
48
|
@dropped_spans.increment(span_records.size)
|
51
|
-
@dropped_span_logs.increment(
|
52
|
-
span_records.reduce(0) {|memo, span|
|
53
|
-
memo + span[:log_records].size + span[:dropped_logs]
|
54
|
-
}
|
55
|
-
)
|
56
49
|
end
|
57
50
|
|
58
51
|
def flush
|
@@ -66,22 +59,16 @@ module LightStep
|
|
66
59
|
dropped_spans = 0
|
67
60
|
@dropped_spans.update{|old| dropped_spans = old; 0 }
|
68
61
|
|
69
|
-
old_dropped_span_logs = 0
|
70
|
-
@dropped_span_logs.update{|old| old_dropped_span_logs = old; 0 }
|
71
|
-
dropped_logs = old_dropped_span_logs
|
72
|
-
dropped_logs = span_records.reduce(dropped_logs) do |memo, span|
|
73
|
-
memo += span.delete :dropped_logs
|
74
|
-
end
|
75
|
-
|
76
62
|
report_request = {
|
77
63
|
runtime: @runtime,
|
78
64
|
oldest_micros: @report_start_time,
|
79
65
|
youngest_micros: now,
|
80
66
|
span_records: span_records,
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
67
|
+
internal_metrics: {
|
68
|
+
counts: [
|
69
|
+
{name: "spans.dropped", int64_value: dropped_spans},
|
70
|
+
]
|
71
|
+
}
|
85
72
|
}
|
86
73
|
|
87
74
|
@report_start_time = now
|
@@ -89,11 +76,9 @@ module LightStep
|
|
89
76
|
begin
|
90
77
|
@transport.report(report_request)
|
91
78
|
rescue
|
92
|
-
|
93
|
-
|
94
|
-
# spans and spans that would have been recorded
|
79
|
+
# an error occurs, add the previous dropped_spans and count of spans
|
80
|
+
# that would have been recorded
|
95
81
|
@dropped_spans.increment(dropped_spans + span_records.length)
|
96
|
-
@dropped_span_logs.increment(old_dropped_span_logs)
|
97
82
|
end
|
98
83
|
end
|
99
84
|
|
@@ -106,7 +91,6 @@ module LightStep
|
|
106
91
|
@pid = $$
|
107
92
|
@span_records.clear
|
108
93
|
@dropped_spans.value = 0
|
109
|
-
@dropped_span_logs.value = 0
|
110
94
|
report_spans
|
111
95
|
end
|
112
96
|
end
|
data/lib/lightstep/span.rb
CHANGED
@@ -16,7 +16,8 @@ module LightStep
|
|
16
16
|
# Creates a new {Span}
|
17
17
|
#
|
18
18
|
# @param tracer [Tracer] the tracer that created this span
|
19
|
-
# @param operation_name [String] the operation name of this span
|
19
|
+
# @param operation_name [String] the operation name of this span. If it's
|
20
|
+
# not a String it will be encoded with to_s.
|
20
21
|
# @param child_of_guid [String] the guid of the span this span is a child of
|
21
22
|
# @param trace_guid [String] the guid of this span's trace
|
22
23
|
# @param start_micros [Numeric] start time of the span in microseconds
|
@@ -37,7 +38,7 @@ module LightStep
|
|
37
38
|
@max_log_records = max_log_records
|
38
39
|
|
39
40
|
@tracer = tracer
|
40
|
-
self.operation_name = operation_name
|
41
|
+
self.operation_name = operation_name.to_s
|
41
42
|
self.start_micros = start_micros
|
42
43
|
@span_context = SpanContext.new(id: LightStep.guid, trace_id: trace_id)
|
43
44
|
set_tag(:parent_span_guid, child_of_id) if !child_of_id.nil?
|
@@ -101,7 +102,7 @@ module LightStep
|
|
101
102
|
record[:payload_json] = JSON.generate(fields, max_nesting: 8)
|
102
103
|
rescue
|
103
104
|
# TODO: failure to encode a payload as JSON should be recorded in the
|
104
|
-
# internal library logs,
|
105
|
+
# internal library logs, being careful not to flood them.
|
105
106
|
end
|
106
107
|
|
107
108
|
log_records.push(record)
|
data/lib/lightstep/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightstep
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bcronin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|