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

feat: rdkafka support to v0.19 including #1403

Merged
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
2 changes: 1 addition & 1 deletion instrumentation/rdkafka/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# SPDX-License-Identifier: Apache-2.0

%w[0.12.0 0.13.0 0.14.0].each do |version|
%w[0.12.0 0.13.0 0.14.0 0.15.0 0.16.0 0.17.0 0.18.0 0.19.0].each do |version|
appraise "rdkafka-#{version}" do
gem 'rdkafka', "~> #{version}"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Rdkafka
class Instrumentation < OpenTelemetry::Instrumentation::Base
compatible do
gem_version = Gem::Version.new(::Rdkafka::VERSION)
Gem::Requirement.new('>= 0.10.0', '< 0.15.0').satisfied_by?(gem_version)
Gem::Requirement.new('>= 0.10.0', '< 0.20.0').satisfied_by?(gem_version)
end

install do |_config|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ module Rdkafka
module Patches
# The Producer module contains the instrumentation patch the Producer#produce method
module Producer
def produce(topic:, payload: nil, key: nil, partition: nil, partition_key: nil, timestamp: nil, headers: nil)
def produce(*args, **kwargs)
topic = kwargs[:topic]
headers = kwargs[:headers] || {}
attributes = {
'messaging.system' => 'kafka',
'messaging.destination' => topic,
'messaging.destination_kind' => 'topic'
}

headers ||= {}

tracer.in_span("#{topic} publish", attributes: attributes, kind: :producer) do
OpenTelemetry.propagation.inject(headers)
kwargs[:headers] = headers
super
end
end
Expand Down
Loading