-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add configurable health check endpoint to online ingestor #207
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
base: main
Are you sure you want to change the base?
Conversation
…ect/scicat-ingestor into feat-integration-test
…ynamic resource provisioning
…nce setup scripts
…roposals and instruments
| def _check_kafka(self) -> bool: | ||
| """Check if Kafka is reachable.""" | ||
| try: | ||
| self.consumer.list_topics(timeout=5) |
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.
I'm not sure if kafka consumer is thread safe.
Should we use threading.Lock?
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.
Hmm... maybe it's okay as we're not consuming messages here...
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.
Good catch, I will do some research on this and keep you updated.
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.
So the confluent-kafka-python library uses librdkafka, which is thread safe according to its documentation. The list_topics() calls librdkafka.rd_kafka_metadata() function which is unrelated to reading messages.
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.
Great! Thank you for letting me know : D
YooSunYoung
left a comment
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.
It looks good to me, apart from the minor concer about using the consumer in the other thread.
Hi @YooSunYoung, I added a new “stress” test script that sends Kafka messages to the online ingestor and, in parallel, continuously calls the health endpoint to see how the app handles it. Based on what I saw in the kafka library and from this test, I’m more confident in the threadsafety. ref: #207 (comment) |
This PR introduces a health check HTTP endpoint to the online ingestor, allowing external monitoring of the service's connectivity to Kafka, storage, and SciCat.