Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: strict rdkafka support to v0.14 #1326

Merged
merged 5 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions instrumentation/rdkafka/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'rdkafka-0.12.x' do
gem 'rdkafka', '~> 0.12.0'
end

appraise 'rdkafka-0.13.x' do
gem 'rdkafka', '~> 0.13.0'
%w[0.12.0 0.13.0 0.14.0].each do |version|
appraise "rdkafka-#{version}" do
gem 'rdkafka', "~> #{version}"
end
end

appraise 'rdkafka-latest' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ module Instrumentation
module Rdkafka
# The Instrumentation class contains logic to detect and install the Rdkafka instrumentation
class Instrumentation < OpenTelemetry::Instrumentation::Base
MINIMUM_VERSION = Gem::Version.new('0.10.0')

compatible do
Gem::Version.new(::Rdkafka::VERSION) >= MINIMUM_VERSION
gem_version = Gem::Version.new(::Rdkafka::VERSION)
Gem::Requirement.new('>= 0.10.0', '< 0.15.0').satisfied_by?(gem_version)
end

install do |_config|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

describe '#install' do
it 'accepts argument' do
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?
_(instrumentation.install({})).must_equal(true)
instrumentation.instance_variable_set(:@installed, false)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

describe '#each' do
it 'traces each call' do
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?

rand_hash = SecureRandom.hex(10)
topic_name = "consumer-patch-trace-#{rand_hash}"
config = { 'bootstrap.servers': "#{host}:#{port}" }
Expand Down Expand Up @@ -112,6 +114,8 @@
end

it 'encodes messages keys depending on input format' do
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?

rand_hash = SecureRandom.hex(10)
topic_name = "consumer-patch-trace-#{rand_hash}"
config = { 'bootstrap.servers': "#{host}:#{port}" }
Expand Down Expand Up @@ -164,6 +168,8 @@

describe '#each_batch' do
it 'traces each_batch call' do
skip "#{Rdkafka::VERSION} is not supported" unless instrumentation.compatible?

rand_hash = SecureRandom.hex(10)
topic_name = "consumer-patch-batch-trace-#{rand_hash}"
config = { 'bootstrap.servers': "#{host}:#{port}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

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

Expand Down
Loading