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

feat: Add health check service to registry server #131

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions sdk/python/feast/registry_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import grpc
from google.protobuf.empty_pb2 import Empty
from grpc_health.v1 import health, health_pb2, health_pb2_grpc
from grpc_reflection.v1alpha import reflection
from pytz import utc

from feast import FeatureStore
Expand All @@ -14,6 +16,7 @@
from feast.infra.registry.base_registry import BaseRegistry
from feast.on_demand_feature_view import OnDemandFeatureView
from feast.protos.feast.registry import RegistryServer_pb2, RegistryServer_pb2_grpc
from feast.protos.feast.registry.RegistryServer_pb2 import DESCRIPTOR
from feast.saved_dataset import SavedDataset, ValidationReference
from feast.stream_feature_view import StreamFeatureView

Expand Down Expand Up @@ -353,6 +356,18 @@ def start_server(store: FeatureStore, port: int):
RegistryServer_pb2_grpc.add_RegistryServerServicer_to_server(
RegistryServer(store.registry), server
)
# Add health check service to server
health_servicer = health.HealthServicer()
health_pb2_grpc.add_HealthServicer_to_server(health_servicer, server)
health_servicer.set("", health_pb2.HealthCheckResponse.SERVING)

service_names_available_for_reflection = (
DESCRIPTOR.services_by_name["RegistryServer"].full_name,
health_pb2.DESCRIPTOR.services_by_name["Health"].full_name,
reflection.SERVICE_NAME,
)
reflection.enable_server_reflection(service_names_available_for_reflection, server)

server.add_insecure_port(f"[::]:{port}")
server.start()
server.wait_for_termination()
Loading