dapr / python-sdk

Dapr SDK for Python
Apache License 2.0
221 stars 125 forks source link

[Feature] Health checks for `dapr-ext-grpc` #722

Closed evhen14 closed 2 months ago

evhen14 commented 2 months ago

I see that the HealthCheck call returns Code: Unimplemented, Message: Method Not Found and I see Method Not Implemented in the source code

The call is made from the dapr code directory for proto files: grpcurl -plaintext -import-path . -proto dapr/proto/runtime/v1/appcallback.proto localhost:50051 /dapr.proto.runtime.v1.AppCallbackHealthCheck/HealthCheck

In the documentation, we have a statement:

When using gRPC for the app channel (app-protocol set to grpc or grpcs), Dapr invokes the method /dapr.proto.runtime.v1.AppCallbackHealthCheck/HealthCheck in your application. Most likely, you will use a Dapr SDK to implement the handler for this method.

Does DaprD call this method for health checks? What does it do when it gets Unimplemented and what does it do when no response is there, for example, when App().run(50051) stopped (in my case it's run in a separate thread).

In Golang SDK, I even see a way to add custom health checks, is there a plan to support it in the Python SDK

Thx in advance!

evhen14 commented 2 months ago

I'm looking into adding an implementation where developers can add a health check callback, e.g. dapr_app.register_health_check(health_check_func)

Let me know what you think

berndverst commented 2 months ago

Will be in dapr-ext-grpc 1.14. That might not be the next version number, but I will synchronize the version name to be aligned with the Dapr runtime versions so it's easier to tell which runtime version will work with this feature for sure.