bc-lightstep-ruby 1.1.7 → 1.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 402c34ffb90db4b5f068099b70c80cc933dc8f4f5f4914de05bd2c09398842a7
4
- data.tar.gz: af092007c4a9a2ceca3bebd200e332e38c2539e8438a3ec9a840a7c03aaf66e5
3
+ metadata.gz: 7cb5dab38cc9f046ed427e5ecccad6cb61349a87af82bdf5b7531e7b48058765
4
+ data.tar.gz: f55e6662e3cfec30437ff8b7357598f1fb24278340fb2e0c51ab2cb3ec573f47
5
5
  SHA512:
6
- metadata.gz: 1adafe2e08b065730025e548b6711b6c6ec673f0c92e022d7b6cd9bf2cef8547ca0867efb3b9b692eccb3f929f2277c8338700ca22c38ef68653fc5ba1c2951b
7
- data.tar.gz: dd4ebff9ddbc843051745e3762a1bc0d8ac2790b5341483192e22dee990718221191c6f20850cec6f68f38ce1e8f914df3b99c0e85e6d056ef8d2c0f795a67a5
6
+ metadata.gz: b1b59b7f0cfc79daaf4bb35f76970d2d1b7fe9eec5a96f86c043fd3dab03b597747b3f06a992172b5763ac5d9fa958a6026dece3f9d68f817aa3739feb44f574
7
+ data.tar.gz: a8d02320ac6d91ff706b0b5778ee3a35d8d39958f77007745e36d5b528d5c5b0a8fd5e7bcc85785c97456bae0b94b75dae21e9601da49c5248e5ee5137c93206
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@ Changelog for the bc-lightstep-ruby gem.
2
2
 
3
3
  h3. Pending Release
4
4
 
5
+ h3. 1.1.8
6
+
7
+ - Handle issue that occurs if lightstep is disabled but the start_span method is still called
8
+ - Remove FORMAT_TEXT_MAP reference as this is no longer present in later lightstep gem versions
9
+
5
10
  h3. 1.1.7
6
11
 
7
12
  - Better handling of exceptions and tagged errors
@@ -36,13 +36,17 @@ module Bigcommerce
36
36
  # @param [Hash] tags (Optional)
37
37
  #
38
38
  def start_span(name, context: nil, start_time: nil, tags: nil)
39
- if Bigcommerce::Lightstep.enabled
39
+ if enabled?
40
40
  # enable the tracer (for fork support)
41
41
  tracer.enable
42
- elsif tracer.enabled?
42
+ elsif tracer && tracer.enabled?
43
43
  # We are not enabled and the tracer is currently on
44
44
  # https://github.com/lightstep/lightstep-tracer-ruby/blob/master/lib/lightstep/tracer.rb#L129-L130
45
- tracer.disable(discard: true)
45
+ # we have to set this through instance_variable_set because of a bug in the core lightstep gem which
46
+ # assumes the presence of a reporter, which happens in the initializer, which may not be called
47
+ # because the reporter attempts to flush spans on initialization (which is bad if lightstep isn't
48
+ # present)
49
+ tracer.instance_variable_set(:@enabled, false)
46
50
  end
47
51
 
48
52
  # find the currently active span
@@ -65,7 +69,7 @@ module Bigcommerce
65
69
  raise
66
70
  ensure
67
71
  # finish this span if the reporter is initialized
68
- span.finish if reporter_initialized?
72
+ span.finish if enabled? && reporter_initialized?
69
73
 
70
74
  # now set back the parent as the active span
71
75
  self.active_span = last_active_span
@@ -98,6 +102,13 @@ module Bigcommerce
98
102
  tracer.instance_variable_defined?(:@reporter) && !tracer.instance_variable_get(:@reporter).nil?
99
103
  end
100
104
 
105
+ ##
106
+ # @return [Boolean]
107
+ #
108
+ def enabled?
109
+ Bigcommerce::Lightstep.enabled
110
+ end
111
+
101
112
  private
102
113
 
103
114
  ##
@@ -108,7 +119,8 @@ module Bigcommerce
108
119
  #
109
120
  def determine_parent(context:)
110
121
  # first attempt to find parent from args, if not, use carrier (headers) to lookup parent
111
- current_parent = context.is_a?(::LightStep::SpanContext) ? context : tracer.extract(::LightStep::Tracer::FORMAT_TEXT_MAP, context || {})
122
+ # 1 = FORMAT_TEXT_MAP (this constant is removed in future lightstep versions)
123
+ current_parent = context.is_a?(::LightStep::SpanContext) ? context : tracer.extract(1, context || {})
112
124
  # if no passed in parent, use the active thread parent
113
125
  current_parent = active_span if current_parent.nil?
114
126
  current_parent
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Bigcommerce
17
17
  module Lightstep
18
- VERSION = '1.1.7'.freeze
18
+ VERSION = '1.1.8'.freeze
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bc-lightstep-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-14 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler