-
Notifications
You must be signed in to change notification settings - Fork 890
Description
Describe your environment
- Python: 3.9.25
- OS: macOS Darwin 25.3.0 (also reproducible on Linux)
- confluent-kafka: 2.6.1
- opentelemetry-instrumentation-confluent-kafka: 0.60b1
- opentelemetry-api: 1.29.0
- opentelemetry-sdk: 1.29.0
What happened?
Calling list_topics() or assignment() on a ProxiedProducer or ProxiedConsumer returned by ConfluentKafkaInstrumentor().instrument_producer() / instrument_consumer() causes a segmentation fault or error RuntimeError: Consumer closed.
Reproducer:
from confluent_kafka import Producer
from opentelemetry.instrumentation.confluent_kafka import ConfluentKafkaInstrumentor
# Create and instrument producer
p = Producer({'bootstrap.servers': 'localhost:9092'})
p_instrumented = ConfluentKafkaInstrumentor().instrument_producer(p)
# This causes a segfault
topics = p_instrumented.list_topics(timeout=5)Note:
There may be more methods missing in the proxy object. And I propose that the Proxy class should proxy all method calls on the actual confluent Kafka client when not defined in the proxy class.
Steps to Reproduce
Start kafka using docker and run following code:
from confluent_kafka import Producer
from opentelemetry.instrumentation.confluent_kafka import ConfluentKafkaInstrumentor
# Create and instrument producer
p = Producer({'bootstrap.servers': 'localhost:9092'})
p_instrumented = ConfluentKafkaInstrumentor().instrument_producer(p)
# This causes a segfault
topics = p_instrumented.list_topics(timeout=5)Expected Result
The app does not crash.
Actual Result
segmentation fault or error RuntimeError: Consumer closed when calling list_topics()
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.