From e176899a7daa02422b6312dfa7635cb7409a13be Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Fri, 1 Mar 2024 12:19:59 -0500 Subject: [PATCH] edit and add cross-linking Signed-off-by: Hannah Hunter --- .../health-checks/sidecar-health.md | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/daprdocs/content/en/operations/resiliency/health-checks/sidecar-health.md b/daprdocs/content/en/operations/resiliency/health-checks/sidecar-health.md index 22f2a9c325d..e89a0d5f0fe 100644 --- a/daprdocs/content/en/operations/resiliency/health-checks/sidecar-health.md +++ b/daprdocs/content/en/operations/resiliency/health-checks/sidecar-health.md @@ -23,11 +23,29 @@ The following diagram shows the steps when a Dapr sidecar starts, the healthz en Diagram of Dapr checking oubound health connections. ## Outbound health endpoint -The `v1.0/healthz/` endpoint is used to wait when all components are initialized, the Dapr HTTP port to be available _and_ the app channel is initialized, as shown by the red boundary lines. This is used to check the complete initialization of the Dapr sidecar and its health. On the other hand, the `v1.0/healthz/outbound` endpoint returns successfully when all the components are initialized, the Dapr HTTP port to be available, but the app channel is not yet established as shown by the green boundary lines. -In the Dapr SDKs the `waitForSidecar` method (for example .NET and Java SDKs) uses for this specific check with the `v1.0/healthz/outbound` endpoint. Using this behavior, Dapr waits for a successful response from `v1.0/healthz/outbound`, rather than waiting for the app channel to be available (as shown by the red boundary lines) with the v1.0/healthz/ endpoint. This approach enables your application to perform calls on the Dapr sidecar APIs before the app channel is initalized, for example reading secrets with the secrets API. +As shown by the red boundary lines in the diagram above, the `v1.0/healthz/` endpoint is used to wait for when: +- All components are initialized; +- The Dapr HTTP port is available; _and,_ +- The app channel is initialized. + +This is used to check the complete initialization of the Dapr sidecar and its health. + +On the other hand, as shown by the green boundary lines in the diagram above, the `v1.0/healthz/outbound` endpoint returns successfully when: +- All the components are initialized; +- The Dapr HTTP port is available; _but,_ +- The app channel is not yet established. + +In the Dapr SDKs, the `waitForSidecar`/`wait_until_ready` method (depending on [which SDK you use]({{< ref "#sdks-supporting-outbound-health-endpoint" >}})) is used for this specific check with the `v1.0/healthz/outbound` endpoint. Using this behavior, instead of waiting for the app channel to be available (see: red boundary lines) with the `v1.0/healthz/` endpoint, Dapr waits for a successful response from `v1.0/healthz/outbound`. This approach enables your application to perform calls on the Dapr sidecar APIs before the app channel is initalized - for example, reading secrets with the secrets API. + +If you are using the `waitForSidecar`/`wait_until_ready` method on the SDKs, then the correct initialization is performed. Otherwise, you can call the `v1.0/healthz/outbound` endpoint during initalization, and if successesful, you can call the Dapr sidecar APIs. + +### SDKs supporting outbound health endpoint +Currently, the `v1.0/healthz/outbound` endpoint is supported in the: +- [.NET SDK](https://github.com/dapr/dotnet-sdk/blob/17f849b17505b9a61be1e7bd3e69586718b9fdd3/src/Dapr.Client/DaprClientGrpc.cs#L1758-L1785) +- [Java SDK](https://github.com/dapr/java-sdk/blob/2f5947392a33bc7911e6669601ddb9e8b59b58fe/sdk/src/main/java/io/dapr/client/DaprClientHttp.java#L143-L165) +- [Python SDK](https://github.com/dapr/python-sdk/blob/0b7aafdab1d4fade424b1b6c9569329ad10bb516/dapr/clients/http/client.py#L52) -If you are using the `waitForSidecar` method on the SDKs then the correct initialization is performed. Otherwise you can call the `v1.0/healthz/outbound` endpoint during initalization, and if successesful, then you can call the Dapr sidecar APIs. ## Health endpoint: Integration with Kubernetes When deploying Dapr to a hosting platform like Kubernetes, the Dapr health endpoint is automatically configured for you.