Closed james-ryans closed 1 year ago
So, when the consumer was ready, it began consuming only the new messages, as the Shopify/sarama package default initial offset is set to the newest.
Rather than 30s wait, perhaps we should configure the consumer to always start from the earliest message? Just need to make sure this will not create interference across tests (ideally they should use different topic names)
also, good to see this is working with 3.6, we currently have Kafka pinned in the workflow https://github.com/jaegertracing/jaeger/blob/1dd4b60a640cd1b81f5bf5e942f003e0572685e8/.github/workflows/ci-kafka.yml#L65
Rather than 30s wait, perhaps we should configure the consumer to always start from the earliest message? Just need to make sure this will not create interference across tests (ideally they should use different topic names)
Currently, ingester doesn't have the ability to configure the initial offset (Shopify/sarama package support to start at the newest or oldest offset). Should we add a flag to configure the initial offset (e.g. --kafka.consumer.initial-offset
) or do we just need to add a field solely to be configurable by the test?
just the internal configuration available to the test would be enough I think.
What happened?
I'm trying to test kafka e2e integration test but it keeps failing at subtest
GetTrace
.I thought my Kafka setup was wrong, but the test successfully produced the traces and consumed incoming messages.
After diving into the test code, it seems that the messages was produced while the consumer was still starting. So, when the consumer was ready, it began consuming only the new messages, as the Shopify/sarama package default initial offset is set to the newest.
I'm able to solve this bug by adding a 30-second sleep waiting for the consumer to start up before producing the messages. However, maybe there might be a better solution?
Steps to reproduce
docker run --name kafka --network jaeger -p 9092:9092 -e KAFKA_CFG_NODE_ID=0 -e KAFKA_CFG_PROCESS_ROLES=controller,broker -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 -e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER -e KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT bitnami/kafka:3.6
./scripts/kafka-integration-test.sh
Expected behavior
The kafka integration
GetTrace
subtest should pass. Try addingtime.Sleep(30 * time.Second)
to fileplugin/storage/integration/integration.go
at line 210 and the test will pass.Relevant log output
No response
Screenshot
No response
Additional context
No response
Jaeger backend version
v1.51
SDK
No response
Pipeline
No response
Stogage backend
No response
Operating system
No response
Deployment model
No response
Deployment configs
No response