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

Confluent kafka Producer doesn't return expected values from poll() and flush() methods when instrumented by ConfluentKafkaInstrumentor().instrument_producer() #2525

Closed
dferrochio opened this issue May 15, 2024 · 0 comments · Fixed by #2527
Labels
bug Something isn't working

Comments

@dferrochio
Copy link
Contributor

Describe your environment

python 3.9
confluent-kafka==2.3.0
opentelemetry-instrumentation-confluent-kafka==0.45b0
opentelemetry-semantic-conventions==0.45b0

Steps to reproduce
Spin up a kafka broker:

docker run -d --name kafka-server --hostname kafka-server \
    -e KAFKA_CFG_NODE_ID=0 \
    -e KAFKA_CFG_PROCESS_ROLES=controller,broker \
    -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 \
    -e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT \
    -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka-server:9093 \
    -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER \
    bitnami/kafka:latest

Run this code:

from opentelemetry.instrumentation.confluent_kafka import ConfluentKafkaInstrumentor
from confluent_kafka import Producer

inst = ConfluentKafkaInstrumentor()
p = confluent_kafka.Producer({'bootstrap.servers': 'localhost:9092'})
p = inst.instrument_producer(p)
p.produce('my-topic', b'raw_bytes')
msg = p.poll(0)
print(msg)
msg_pending = p.flush5)
print(msg_pending)

What is the expected behavior?
Should be printed:

0
1

Producer poll() and flush() methods should return integers.

What is the actual behavior?

None
None

Producer poll() and flush() methods are returning None

Additional context

flush and poll methods doesn't have a return statement:

@dferrochio dferrochio added the bug Something isn't working label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant