dapr / python-sdk

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

Health check #670

Closed elena-kolevska closed 7 months ago

elena-kolevska commented 7 months ago

Description

This PR adds a health check against Dapr's health endpoint instead of checking if the socket is open.

The check is added on all the clients' init methods (grpc, http, async grpc, actor and invocation).

The timeout can be configured through the DAPR_HEALTH_TIMEOUT environment variable.

The default value for DAPR_HEALTH_TIMEOUT is 60 seconds.

Issue reference

https://github.com/dapr/python-sdk/issues/611

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

Release notes

When connecting to a remote sidecar, DAPR_HTTP_ENDPOINT needs to be set, even when only gRPC is used, because the health endpoint is http-only.

codecov[bot] commented 7 months ago

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (fc0e9d1) 86.37% compared to head (1e7f332) 86.18%. Report is 4 commits behind head on main.

Files Patch % Lines
dapr/clients/health.py 72.72% 9 Missing :warning:
dapr/aio/clients/grpc/client.py 92.15% 4 Missing :warning:
dapr/actor/client/proxy.py 57.14% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #670 +/- ## ========================================== - Coverage 86.37% 86.18% -0.19% ========================================== Files 79 82 +3 Lines 4094 4170 +76 ========================================== + Hits 3536 3594 +58 - Misses 558 576 +18 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.