Skip to content

feat(pika): add thread-safe channel instrumentation support - #924

Open
CagriYonca wants to merge 1 commit into
mainfrom
pika-update
Open

CagriYonca wants to merge 1 commit into
mainfrom
pika-update

Conversation

@CagriYonca

Copy link
Copy Markdown
Contributor

Summary

Pika 1.5.0 broke three publish tests, because they mock the private _send_method, which Channel.basic_publish no longer calls. This PR fixes them and closes the instrumentation gaps found while reviewing 1.5.0.

Changes

  • Tests: a version-aware sent_message fixture asserts on connection._marshal_message (≥ 1.5.0) or _send_method (older).
  • Bug fix: basic_consume(..., callback=...) raised TypeError and broke customer code, because the ConsumeOk callback was mistaken for the message callback. queue="" also raised IndexError.
  • Thread-safe channel (pika ≥ 1.5.0): instrumented basic_publish and basic_consume, so consumer callbacks run inside the span on the worker thread. The underlying channel's wrapper is removed in __init__ to avoid double spans.

Tests

Added tests for the fixes, the new helpers and the thread-safe publish and consume paths, including error paths. They pass on pika 1.4.1 and 1.5.0, and the thread-safe tests are skipped on older versions.

Signed-off-by: Cagri Yonca <cagri@ibm.com>
@CagriYonca CagriYonca self-assigned this Nov 23, 2026
@CagriYonca
CagriYonca requested a review from a team as a code owner November 23, 2026 14:27

This branch has not been deployed

No deployments
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