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

Kafka service: healthcheck passes but causes exceptions #125

Open
marcalwestf opened this issue Oct 19, 2024 · 0 comments
Open

Kafka service: healthcheck passes but causes exceptions #125

marcalwestf opened this issue Oct 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@marcalwestf
Copy link
Contributor

marcalwestf commented Oct 19, 2024

When all services were started and the Kafka log is inspected with the help of
docker logs adempiere-ui-gateway.kafka | less

The result is a recurrent exception, which is thrown constantly every 10 seconds, cluttering the log:
Selection_588

The exception and the 10 seconds stem from the docker compose Kafka healthcheck definition:
image

Luckily, this exception doesn't mark the container as unhealthy, but it makes the log unreadable and can cause confusion.
It is thus desirable to get rid of it.

According to Stackoverflow and other sites, Kafka doesn't accept HTTP requests, as GET, but only its own commands.
Here are some of the suggestions for a Kafka healthcheck:

Suggestion # 1: create a topic, read and delete it
test: ["CMD-SHELL", "echo 'test-message' | /usr/bin/kafka-console-producer --broker-list localhost:9092 --topic adempiere-test-health-check-topic && /usr/bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic adempiere-test-health-check-topic --from-beginning --max-messages 1 | grep 'test-message' & /usr/bin/kafka-topics --bootstrap-server localhost:9092 --delete --topic adempiere-test-health-check-topic"]

Suggestion # 2: create a topic and read it
test: ["CMD-SHELL", "echo 'test-message' | /usr/bin/kafka-console-producer --broker-list localhost:9092 --topic adempiere-test-health-check-topic && /usr/bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic adempiere-test-health-check-topic --from-beginning --max-messages 1 | grep 'test-message' "]

Suggestion # 3: call a command
test: [ "CMD-SHELL", "/usr/bin/kafka-broker-api-versions --bootstrap-server localhost:9092" ]

Suggestion # 4: list existig topics
test: [ "CMD-SHELL", "/usr/bin/kafka-topics --bootstrap-server localhost:9092 --list "]

The less invasive is the last one, which communicates with the Kafka server and gets __consumer_offsets, the only topic existing after creating the container:

$KAFKA_HOME/bin/kafka-topics.sh --bootstrap-server 192.168.100.13:29092 --list
 __consumer_offsets
@marcalwestf marcalwestf self-assigned this Oct 19, 2024
@marcalwestf marcalwestf added the bug Something isn't working label Oct 19, 2024
@marcalwestf marcalwestf changed the title Kafka service: healthcheck causes exceptions Kafka service: healthcheck passes but causes exceptions Oct 19, 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

No branches or pull requests

1 participant