-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
opentelemetry-instrumentation-kafka-python: wait for metadata #1260
opentelemetry-instrumentation-kafka-python: wait for metadata #1260
Conversation
Kafka's instance metadata could be unavailable (because it's being filled asynchronously). extract_send_partition() is based on a metadata, so it may return `None` for partition and later cause all type of warning messages (e.g. `Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types`). The proposed fix makes sure metadata is pre-populated (based on https://github.com/dpkp/kafka-python/blob/4d598055dab7da99e41bfcceffa8462b32931cdd/kafka/producer/kafka.py#L579). I'm just not sure if we should wrap `_wait_on_metadata` into try\except, maybe just passing Exception to the caller would be a better idea...
opentelemetry-instrumentation-kafka-python
: wait for metadata
opentelemetry-instrumentation-kafka-python
: wait for metadata
Local tests have been passed successfully:
|
…apetyan/opentelemetry-python-contrib into fix_kafka_wait_metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test case
@ocelotl, thanks, added. |
Hi @ocelotl, could we merge this change? |
Description
Kafka's instance metadata could be unavailable (because it's being filled asynchronously).
extract_send_partition() is based on a metadata, so it may return
None
for partition and later produce a warning message:Invalid type NoneType for attribute value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
The proposed fix makes sure metadata is pre-populated (based on https://github.com/dpkp/kafka-python/blob/4d598055dab7da99e41bfcceffa8462b32931cdd/kafka/producer/kafka.py#L579).
Type of change
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist: