diff --git a/tests/instrumentation/kafka_tests.py b/tests/instrumentation/kafka_tests.py index 6d1c51be1..253f9c6b9 100644 --- a/tests/instrumentation/kafka_tests.py +++ b/tests/instrumentation/kafka_tests.py @@ -224,6 +224,8 @@ def delayed_send(): thread = threading.Thread(target=delayed_send) thread.start() transaction = elasticapm_client.begin_transaction("foo") + # Give Kafka enough time to resolve offsets and deliver all delayed records before iteration stops. + consumer.config["consumer_timeout_ms"] = 2000 for item in consumer: pass thread.join()