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

Support Health Check for Kafka Streams extension #4793

Closed
lhauspie opened this issue Oct 23, 2019 · 1 comment · Fixed by #5125
Closed

Support Health Check for Kafka Streams extension #4793

lhauspie opened this issue Oct 23, 2019 · 1 comment · Fixed by #5125

Comments

@lhauspie
Copy link
Contributor

Description
As @gunnarmorling said in the #4675 issue, kafka streams doesn't expose any health checks or metrics. It could be interesting to add the health check capability (at least readiness) as the #4675 seems to be only about metrics.

Implementation ideas
Just create the @Readiness that will check if the quarkus.kafka-streams.topics are reachable or not. Maybe by reusing a part of the source code of KafkaStreamsTopologyManager#waitForTopicsToBeCreated:

        try (AdminClient adminClient = AdminClient.create(config)) {
            while (true) {
                try {
                    ListTopicsResult topics = adminClient.listTopics();
                    Set<String> topicNames = topics.names().get(10, TimeUnit.SECONDS);

                    if (topicNames.containsAll(topicsToAwait)) {
                        LOGGER.debug("All expected topics created");
                        return;
                    } else {
                        HashSet<String> missing = new HashSet<>(topicsToAwait);
                        missing.removeAll(topicNames);
                        LOGGER.debug("Waiting for topic(s) to be created: " + missing);
                    }

                    Thread.sleep(1_000);
                } catch (ExecutionException | TimeoutException e) {
                    LOGGER.error("Failed to get topic names from broker", e);
                }
            }
        }

Then add the @BuildStep in deployment module that will addHealthCheck by creating the HealthBuildItem refering to the previous @Readiness class.

@lhauspie
Copy link
Contributor Author

I'll be glad to help on this topic if you're ok with that issue.

@gsmet gsmet changed the title Support Health Check for kafka streams extension Support Health Check for Kafka Streams extension Dec 6, 2019
@gsmet gsmet added this to the 1.1.0 milestone Dec 6, 2019
mmusgrov pushed a commit to mmusgrov/quarkus that referenced this issue Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants