Skip to content

rdkafka v0.15.0+ incompatibility #1325

Open
@arielvalentin

Description

The instrumentation has not been compatible since 0.15.0. The monkey patches do not honor the current method signature of the Producer class and ends up reverting it back to earlier versions.

It also looks like we can no longer instrument each_batch starting in v0.20.0:

https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/12657654638/job/35272889337?pr=1323

    1) Error:
  OpenTelemetry::Instrumentation::Rdkafka::Patches::Consumer::#each_batch#test_0001_traces each_batch call:
  NotImplementedError: `each_batch` has been removed due to data consistency concerns.
  
  This method was removed because it did not properly handle partition reassignments,
  which could lead to processing messages from partitions that were no longer owned
  by this consumer, resulting in duplicate message processing and data inconsistencies.
  
  Recommended alternatives:
  
  1. Implement your own batching logic using rebalance callbacks to properly handle
     partition revocations and ensure message processing correctness.
  
  2. Use a high-level batching library that supports proper partition reassignment
     handling out of the box (such as the Karafka framework).
  
      /opt/hostedtoolcache/Ruby/3.3.6/x64/lib/ruby/gems/3.3.0/gems/rdkafka-0.20.0/lib/rdkafka/consumer.rb:614:in `each_batch'
      lib/opentelemetry/instrumentation/rdkafka/patches/consumer.rb:46:in `each_batch'
      test/opentelemetry/instrumentation/rdkafka/patches/consumer_test.rb:196:in `block (3 levels) in <top (required)>'
  
  7 runs, 30 assertions, 0 failures, 1 errors, 0 skips
  rake aborted!
  Command failed with status (1)
  /opt/hostedtoolcache/Ruby/3.3.6/x64/bin/bundle:25:in `load'
  /opt/hostedtoolcache/Ruby/3.3.6/x64/bin/bundle:25:in `<main>'
  Tasks: TOP => test
  (See full trace by running task with --trace)

We must ensure that instrumentations do not negatively impact gems or introduce regressions in functionality.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions