Skip to content

Commit 46655f0

Browse files
EXPEbdodlaBhargav Dodla
and
Bhargav Dodla
authored
feat: Add health check service to registry server (#4421)
Signed-off-by: Bhargav Dodla <bdodla@expediagroup.com> Co-authored-by: Bhargav Dodla <bdodla@expediagroup.com>
1 parent d18d01d commit 46655f0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

sdk/python/feast/registry_server.py

+14
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import grpc
55
from google.protobuf.empty_pb2 import Empty
6+
from grpc_health.v1 import health, health_pb2, health_pb2_grpc
7+
from grpc_reflection.v1alpha import reflection
68

79
from feast import FeatureStore
810
from feast.data_source import DataSource
@@ -353,6 +355,18 @@ def start_server(store: FeatureStore, port: int):
353355
RegistryServer_pb2_grpc.add_RegistryServerServicer_to_server(
354356
RegistryServer(store.registry), server
355357
)
358+
# Add health check service to server
359+
health_servicer = health.HealthServicer()
360+
health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)
361+
health_servicer.set("", health_pb2.HealthCheckResponse.SERVING)
362+
363+
service_names_available_for_reflection = (
364+
RegistryServer_pb2.DESCRIPTOR.services_by_name["RegistryServer"].full_name,
365+
health_pb2.DESCRIPTOR.services_by_name["Health"].full_name,
366+
reflection.SERVICE_NAME,
367+
)
368+
reflection.enable_server_reflection(service_names_available_for_reflection, server)
369+
356370
server.add_insecure_port(f"[::]:{port}")
357371
server.start()
358372
server.wait_for_termination()

0 commit comments

Comments
 (0)