Skip to content

Commit 48b3206

Browse files
fix: strict rdkafka support to v0.14 (#1326)
* fix: strict rdkafka support to v0.14 * squash: fix argument error * squash: OMG * squash: skip incompatible versions * squash: use compatible? predicate
1 parent 0cfc9d0 commit 48b3206

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

instrumentation/rdkafka/Appraisals

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
#
55
# SPDX-License-Identifier: Apache-2.0
66

7-
appraise 'rdkafka-0.12.x' do
8-
gem 'rdkafka', '~> 0.12.0'
9-
end
10-
11-
appraise 'rdkafka-0.13.x' do
12-
gem 'rdkafka', '~> 0.13.0'
7+
%w[0.12.0 0.13.0 0.14.0].each do |version|
8+
appraise "rdkafka-#{version}" do
9+
gem 'rdkafka', "~> #{version}"
10+
end
1311
end
1412

1513
appraise 'rdkafka-latest' do

instrumentation/rdkafka/lib/opentelemetry/instrumentation/rdkafka/instrumentation.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ module Instrumentation
99
module Rdkafka
1010
# The Instrumentation class contains logic to detect and install the Rdkafka instrumentation
1111
class Instrumentation < OpenTelemetry::Instrumentation::Base
12-
MINIMUM_VERSION = Gem::Version.new('0.10.0')
13-
1412
compatible do
15-
Gem::Version.new(::Rdkafka::VERSION) >= MINIMUM_VERSION
13+
gem_version = Gem::Version.new(::Rdkafka::VERSION)
14+
Gem::Requirement.new('>= 0.10.0', '< 0.15.0').satisfied_by?(gem_version)
1615
end
1716

1817
install do |_config|

instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/instrumentation_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
describe '#install' do
2424
it 'accepts argument' do
25+
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
2526
_(instrumentation.install({})).must_equal(true)
2627
instrumentation.instance_variable_set(:@installed, false)
2728
end

instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
describe '#each' do
3535
it 'traces each call' do
36+
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
37+
3638
rand_hash = SecureRandom.hex(10)
3739
topic_name = "consumer-patch-trace-#{rand_hash}"
3840
config = { 'bootstrap.servers': "#{host}:#{port}" }
@@ -112,6 +114,8 @@
112114
end
113115

114116
it 'encodes messages keys depending on input format' do
117+
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
118+
115119
rand_hash = SecureRandom.hex(10)
116120
topic_name = "consumer-patch-trace-#{rand_hash}"
117121
config = { 'bootstrap.servers': "#{host}:#{port}" }
@@ -164,6 +168,8 @@
164168

165169
describe '#each_batch' do
166170
it 'traces each_batch call' do
171+
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
172+
167173
rand_hash = SecureRandom.hex(10)
168174
topic_name = "consumer-patch-batch-trace-#{rand_hash}"
169175
config = { 'bootstrap.servers': "#{host}:#{port}" }

instrumentation/rdkafka/test/opentelemetry/instrumentation/rdkafka/patches/producer_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
describe 'tracing' do
3434
it 'traces sync produce calls' do
35+
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
3536
topic_name = 'producer-patch-trace'
3637
config = { 'bootstrap.servers': "#{host}:#{port}" }
3738

0 commit comments

Comments
 (0)