lightstep 0.10.8 → 0.10.9

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: cb5c525e6e010a41c04b1d6eb448384b1b514d47
4
- data.tar.gz: 9bd52f884ea30db79b7b9cd5e21f7d6083be5fb3
3
+ metadata.gz: c95a5745b43ca1428f8ff9f7ea8c7b70c42c7401
4
+ data.tar.gz: 6b4b663ae87b92acd2221f13528aa60e68ee81f2
5
5
  SHA512:
6
- metadata.gz: bf297bdc0b04728703ef4bccd803d94676ac1678081307070f74ea1418318b7765b616e9359256dd5ab647fb80b18ca9487c71442c47797c54b2bcc207621e44
7
- data.tar.gz: 50d4d038884a70d12adb667e32f461a25653d260f3bfedefd7a7230a0fc8b776567f6f4d5f843a15eade14c27b769f1ebc21b6cd5e7801f427c4426737b32b0a
6
+ metadata.gz: a57a5ebb53299e9d1576d53d9674e5bb2bf9a958185ea3175467a5d44ac1f43d0edf873e65847ac917b8702bc397ebd1284f5dc9bacd056e4688f50d85ab4a33
7
+ data.tar.gz: 34d6ff31de150cb543449ec7b4440e4c989742a170fe3d195168df4ab1b0eb2dd69dc4b2e53ff2fbc9ff3ff9e0ccd791306252fa96cbd2306b2e219f3a79c6b5
@@ -13,38 +13,40 @@ puts 'Starting...'
13
13
  (1..20).each do |k|
14
14
  puts "Explicit reset iteration #{k}..."
15
15
 
16
- pid = Process.fork do
17
- 10.times do
18
- span = LightStep.start_span("my_forked_span-#{Process.pid}")
19
- sleep(0.0025 * rand(k))
20
- span.finish
21
- end
22
- LightStep.flush
23
- end
24
-
25
- 10.times do
16
+ # pid = Process.fork do
17
+ # 10.times do
18
+ # span = LightStep.start_span("my_forked_span-#{Process.pid}")
19
+ # sleep(0.0025 * rand(k))
20
+ # span.finish
21
+ # end
22
+ # LightStep.flush
23
+ # end
24
+
25
+ 3.times do
26
26
  span = LightStep.start_span("my_process_span-#{Process.pid}")
27
27
  sleep(0.0025 * rand(k))
28
+ span.set_tag(:empty, "")
29
+ span.set_tag(:full, "full")
28
30
  span.finish
29
31
  end
30
32
 
31
- # Make sure redundant enable calls don't cause problems
32
- # NOTE: disabling discards the buffer by default, so all spans
33
- # get cleared here except the final toggle span
34
- 10.times do
35
- LightStep.disable
36
- LightStep.enable
37
- LightStep.disable
38
- LightStep.disable
39
- LightStep.enable
40
- LightStep.enable
41
- span = LightStep.start_span("my_toggle_span-#{Process.pid}")
42
- sleep(0.0025 * rand(k))
43
- span.finish
44
- end
45
-
46
- puts "Parent, pid #{Process.pid}, waiting on child pid #{pid}"
47
- Process.wait(pid)
33
+ # # Make sure redundant enable calls don't cause problems
34
+ # # NOTE: disabling discards the buffer by default, so all spans
35
+ # # get cleared here except the final toggle span
36
+ # 10.times do
37
+ # LightStep.disable
38
+ # LightStep.enable
39
+ # LightStep.disable
40
+ # LightStep.disable
41
+ # LightStep.enable
42
+ # LightStep.enable
43
+ # span = LightStep.start_span("my_toggle_span-#{Process.pid}")
44
+ # sleep(0.0025 * rand(k))
45
+ # span.finish
46
+ # end
47
+
48
+ # puts "Parent, pid #{Process.pid}, waiting on child pid #{pid}"
49
+ # Process.wait(pid)
48
50
  end
49
51
 
50
52
  puts 'Done!'
@@ -183,15 +183,19 @@ module LightStep
183
183
  CARRIER_TRACER_STATE_PREFIX = 'ot-tracer-'.freeze
184
184
  CARRIER_BAGGAGE_PREFIX = 'ot-baggage-'.freeze
185
185
 
186
+ CARRIER_SPAN_ID = (CARRIER_TRACER_STATE_PREFIX + 'spanid').freeze
187
+ CARRIER_TRACE_ID = (CARRIER_TRACER_STATE_PREFIX + 'traceid').freeze
188
+ CARRIER_SAMPLED = (CARRIER_TRACER_STATE_PREFIX + 'sampled').freeze
189
+
186
190
  DEFAULT_MAX_LOG_RECORDS = 1000
187
191
  MIN_MAX_LOG_RECORDS = 1
188
192
  DEFAULT_MAX_SPAN_RECORDS = 1000
189
193
  MIN_MAX_SPAN_RECORDS = 1
190
194
 
191
195
  def inject_to_text_map(span, carrier)
192
- carrier[CARRIER_TRACER_STATE_PREFIX + 'spanid'] = span.span_context.id
193
- carrier[CARRIER_TRACER_STATE_PREFIX + 'traceid'] = span.span_context.trace_id unless span.span_context.trace_id.nil?
194
- carrier[CARRIER_TRACER_STATE_PREFIX + 'sampled'] = 'true'
196
+ carrier[CARRIER_SPAN_ID] = span.span_context.id
197
+ carrier[CARRIER_TRACE_ID] = span.span_context.trace_id unless span.span_context.trace_id.nil?
198
+ carrier[CARRIER_SAMPLED] = 'true'
195
199
 
196
200
  span.span_context.baggage.each do |key, value|
197
201
  carrier[CARRIER_BAGGAGE_PREFIX + key] = value
@@ -199,12 +203,18 @@ module LightStep
199
203
  end
200
204
 
201
205
  def extract_from_text_map(operation_name, carrier)
206
+ # If the carrier does not have both the span_id and trace_id key
207
+ # skip the processing and just return a normal span
208
+ if !carrier.has_key?(CARRIER_SPAN_ID) || !carrier.has_key?(CARRIER_TRACE_ID)
209
+ return start_span(operation_name)
210
+ end
211
+
202
212
  span = Span.new(
203
213
  tracer: self,
204
214
  operation_name: operation_name,
205
215
  start_micros: LightStep.micros(Time.now),
206
- child_of_id: carrier[CARRIER_TRACER_STATE_PREFIX + 'spanid'],
207
- trace_id: carrier[CARRIER_TRACER_STATE_PREFIX + 'traceid'],
216
+ child_of_id: carrier[CARRIER_SPAN_ID],
217
+ trace_id: carrier[CARRIER_TRACE_ID],
208
218
  max_log_records: max_log_records
209
219
  )
210
220
 
@@ -222,9 +232,9 @@ module LightStep
222
232
  end
223
233
 
224
234
  def inject_to_rack(span, carrier)
225
- carrier[CARRIER_TRACER_STATE_PREFIX + 'spanid'] = span.span_context.id
226
- carrier[CARRIER_TRACER_STATE_PREFIX + 'traceid'] = span.span_context.trace_id unless span.span_context.trace_id.nil?
227
- carrier[CARRIER_TRACER_STATE_PREFIX + 'sampled'] = 'true'
235
+ carrier[CARRIER_SPAN_ID] = span.span_context.id
236
+ carrier[CARRIER_TRACE_ID] = span.span_context.trace_id unless span.span_context.trace_id.nil?
237
+ carrier[CARRIER_SAMPLED] = 'true'
228
238
 
229
239
  span.span_context.baggage.each do |key, value|
230
240
  if key =~ /[^A-Za-z0-9\-_]/
@@ -1,3 +1,3 @@
1
1
  module LightStep
2
- VERSION = '0.10.8'.freeze
2
+ VERSION = '0.10.9'.freeze
3
3
  end
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.8
4
+ version: 0.10.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - bcronin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby