bc-lightstep-ruby 2.4.1 → 2.6.1

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
  SHA256:
3
- metadata.gz: dea96b1f8199a7f6f69a07e76849d5d1fffaa6a2875abb428766cd34717e230b
4
- data.tar.gz: e3f42dcd9d466d5cb20b3aefe7d0a63fb18fc4e9004d534214e1cc8a67533454
3
+ metadata.gz: 601c8290786658777472d7b16c8012b8758c4dcc2e4853cf5cdc3bf205133d50
4
+ data.tar.gz: 3f37e614a404c05d1677dff48f322b60e3cdbb4c4aba9d14b7da6f88e4b453a0
5
5
  SHA512:
6
- metadata.gz: c6a1267f116201b2f1f40d115c0fec8cd38b5b9b954a364bb21f73aa5651b1eee1734e1a00fd3543d6b933b7a90206f1f88e90786dd60c15c1e2862e4edd8d0b
7
- data.tar.gz: dc9124a5acfa9872af9fa5208fc858dee5041737e8c9c8c898ea618363f8f23c74d6507ffe17421fb9327734f687c2403136b30bc2afad7fccefca8b57f6e517
6
+ metadata.gz: fb660259c8196c8b053e0170bd6a86e09e0447151dd5e95188f5469456efeac647f05169d07bcd58cae5f6daa082c908db20f9d5dcb58b5fe8be725f2f91f1d2
7
+ data.tar.gz: ac9b91ec6d91becbd2fc564914f10db4d649b34f67558c9d77559e8f160531b399572abb8d4063c2b96128834133388c07a413f3d802e0537f637d2294815f3e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@ Changelog for the bc-lightstep-ruby gem.
2
2
 
3
3
  ### Pending Release
4
4
 
5
+ ### 2.6.1
6
+
7
+ * Supports hook for controllers to specify additional span tags
8
+
9
+ ### 2.6.0
10
+
11
+ * Add support for Rails/ActiveRecord 7
12
+ * Add test coverage for Ruby 3.2
13
+
14
+ ### 2.5.0
15
+
16
+ * Drop support for Ruby 2
17
+ * Remove unused NullLogger dev dependency
18
+
5
19
  ### 2.4.1
6
20
 
7
21
  * Support positional argument methods when using the `Traceable` trace method
@@ -31,22 +31,20 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.files = Dir['README.md', 'CHANGELOG.md', 'CODE_OF_CONDUCT.md', 'lib/**/*', 'bc-lightstep-ruby.gemspec']
33
33
  spec.require_paths = ['lib']
34
- spec.required_ruby_version = '>= 2.7'
34
+ spec.required_ruby_version = '>= 3.0'
35
35
  spec.metadata['rubygems_mfa_required'] = 'true'
36
36
 
37
37
  spec.add_development_dependency 'activerecord', '> 4'
38
38
  spec.add_development_dependency 'bundler-audit', '~> 0.6'
39
39
  spec.add_development_dependency 'rake', '>= 12.0'
40
- spec.add_development_dependency 'rspec', '~> 3.8'
40
+ spec.add_development_dependency 'redis', '~> 4'
41
+ spec.add_development_dependency 'rspec', '>= 3.8'
41
42
  spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
42
- spec.add_development_dependency 'rubocop', '~> 1.0'
43
+ spec.add_development_dependency 'rubocop', '>= 1.0'
43
44
  spec.add_development_dependency 'rubocop-performance', '>= 1.5'
44
45
  spec.add_development_dependency 'simplecov', '~> 0.15'
45
46
  spec.add_development_dependency 'pry', '>= 0.12'
46
47
 
47
- spec.add_development_dependency 'null-logger', '~> 0.1'
48
- spec.add_development_dependency 'redis', '~> 4'
49
-
50
48
  spec.add_runtime_dependency 'activesupport', '>= 4'
51
49
  spec.add_runtime_dependency 'lightstep', '~> 0.17.0'
52
50
  spec.add_runtime_dependency 'faraday', ['>= 0.8', '< 2']
@@ -36,12 +36,21 @@ module Bigcommerce
36
36
  end
37
37
 
38
38
  ##
39
- # Note: we only support patching mysql2 gem at this point
39
+ # Note: we only support patching mysql2 gem at this point.
40
40
  #
41
41
  # @return [Boolean]
42
42
  #
43
43
  def self.enabled?
44
- defined?(::ActiveRecord) && ::Bigcommerce::Lightstep.active_record && ::ActiveRecord::Base.connection_config[:adapter].to_s.casecmp('mysql2').zero?
44
+ return false unless defined?(::ActiveRecord) && ::Bigcommerce::Lightstep.active_record
45
+
46
+ adapter_name = if ::ActiveRecord::Base.respond_to?(:connection_config) # rails 6
47
+ ::ActiveRecord::Base.connection_config[:adapter].to_s
48
+ elsif ::ActiveRecord::Base.respond_to?(:connection_db_config) # rails 7
49
+ ::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter].to_s
50
+ else
51
+ 'unknown'
52
+ end
53
+ adapter_name.casecmp('mysql2')&.zero? == true
45
54
  rescue StandardError => e
46
55
  ::Bigcommerce::Lightstep.logger&.warn "Failed to determine ActiveRecord database adapter in bc-lightstep-ruby initializer: #{e.message}"
47
56
  false
@@ -51,9 +60,9 @@ module Bigcommerce
51
60
  # @param [String] sql The raw sql query
52
61
  # @param [String] name The type of sql query
53
62
  #
54
- def execute_with_inst(sql, name = 'SQL')
63
+ def execute_with_inst(sql, name = 'SQL', async: false)
55
64
  # bail out early if not enabled. This should not get here, but is provided as a failsafe.
56
- return execute_without_inst(sql, name) unless ::Bigcommerce::Lightstep.active_record
65
+ return execute_without_inst(sql, name, async: async) unless ::Bigcommerce::Lightstep.active_record
57
66
 
58
67
  sanitized_sql = lightstep_sanitize_sql(sql)
59
68
  name = 'QUERY' if name.to_s.strip.empty?
@@ -30,6 +30,10 @@ module Bigcommerce
30
30
  span.set_tag('http.content_type', request.format)
31
31
  span.set_tag('http.host', request.host)
32
32
  span.set_tag('span.kind', 'server')
33
+
34
+ # provide a hook for controllers to provide additional span tags
35
+ lightstep_additional_span_tags.each { |tag_name, value| span.set_tag(tag_name.to_s, value.to_s) }
36
+
33
37
  begin
34
38
  resp = yield
35
39
  rescue StandardError => _e
@@ -48,6 +52,15 @@ module Bigcommerce
48
52
  result
49
53
  end
50
54
 
55
+ ##
56
+ # Get list of additional span tags
57
+ #
58
+ # @return [Hash]
59
+ #
60
+ def lightstep_additional_span_tags
61
+ {}
62
+ end
63
+
51
64
  ##
52
65
  # Get only the open tracing headers
53
66
  #
@@ -17,6 +17,6 @@
17
17
  #
18
18
  module Bigcommerce
19
19
  module Lightstep
20
- VERSION = '2.4.1'
20
+ VERSION = '2.6.1'
21
21
  end
22
22
  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: 2.4.1
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun McCormick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -53,17 +53,31 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '12.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rspec
56
+ name: redis
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.8'
61
+ version: '4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '3.8'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '3.8'
69
83
  - !ruby/object:Gem::Dependency
@@ -84,14 +98,14 @@ dependencies:
84
98
  name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '1.0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '1.0'
97
111
  - !ruby/object:Gem::Dependency
@@ -136,34 +150,6 @@ dependencies:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0.12'
139
- - !ruby/object:Gem::Dependency
140
- name: null-logger
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '0.1'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '0.1'
153
- - !ruby/object:Gem::Dependency
154
- name: redis
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '4'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '4'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: activesupport
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -269,14 +255,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
255
  requirements:
270
256
  - - ">="
271
257
  - !ruby/object:Gem::Version
272
- version: '2.7'
258
+ version: '3.0'
273
259
  required_rubygems_version: !ruby/object:Gem::Requirement
274
260
  requirements:
275
261
  - - ">="
276
262
  - !ruby/object:Gem::Version
277
263
  version: '0'
278
264
  requirements: []
279
- rubygems_version: 3.3.3
265
+ rubygems_version: 3.4.20
280
266
  signing_key:
281
267
  specification_version: 4
282
268
  summary: Gem for lightstep distributed tracing