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

Updates Client to create Bunny::Consumer with queue obj, not string #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mh120888
Copy link

@mh120888 mh120888 commented Mar 28, 2024

This change should not result in any change in functionality.

The motivation behind introducing this change is two-fold:

  1. The official Bunny documentation shows multiple examples where a Bunny::Consumer object is initialized with a Bunny::Queue object as the queue parameter, and none where the queue parameter is a string literal. Although the string parameter is documented and supported by the bunny gem, the examples given and community usage seems to show a preference for passing a Queue object.
  2. The OpenTelemetry bunny instrumentation gem is currently incompatible with the current version of bunny_burrow. The OTel gem works by patching a number of methods in Bunny classes, and expects to be able to call queue.channel inside its patch of Bunny::Consumer#call. This results in a runtime error with the current versions of bunny_burrow and the OTel gem. See https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/bunny/lib/opentelemetry/instrumentation/bunny/patches/consumer.rb#L14

Regarding point 2 above, I acknowledge that the "better" course of action would probably be to file a bug report with the OTel bunny instrumentation gem. In my opinion, the authors of the gem made an incorrect assumption about the underlying Bunny gem that contradicts the latter's own documentation.

That said, I don't believe there's any harm in making this change to bunny_burrow AND it is the quicker option. Since this issue is currently a blocker to being able to use the OTel bunny instrumentation gem with a project that uses bunny_burrow, I decided to propose this fix change.

This change should not result in any change in functionality.

The motivation behind introducing this change is two-fold:
1. The official Bunny documentation shows multiple examples where
   a Bunny::Consumer object is initialized with a Bunny::Queue object as the
queue parameter, and none where the queue parameter is a string literal.
Although the string parameter is documented and supported by the bunny
gem, the examples given and community usage seems to show a preference
for passing a Queue object.
2. The OpenTelemetry bunny instrumentation gem is currently incompatible
   with the current version of bunny_burrow. The OTel gem works by
patching a number of methods in Bunny classes, and expects to be able to
call `queue.channel` inside its patch of Bunny::Consumer#call`. This
results in a runtime error with the current versions of bunny_burrow and
the OTel gem. See https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/bunny/lib/opentelemetry/instrumentation/bunny/patches/consumer.rb#L14

Regarding point 2 above, I acknowledge that the "better" course of
action would probably be to file a bug report with the OTel bunny
instrumentation gem. In my opinion, the authors of the gem made an
incorrect assumption about the underlying Bunny gem that contradicts the
latter's own documentation.

That said, I don't believe there's any harm in making this change to
bunny_burrow AND it is the quicker course of action. Since this issue is
currently a blocker to being able to use the OTel bunny instrumentation
gem with a project that uses bunny_burrow, I decided to propose this
fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant