Skip to content

Commit

Permalink
edit and add cross-linking
Browse files Browse the repository at this point in the history
Signed-off-by: Hannah Hunter <[email protected]>
  • Loading branch information
hhunter-ms committed Mar 1, 2024
1 parent e5f9dc0 commit e176899
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,29 @@ The following diagram shows the steps when a Dapr sidecar starts, the healthz en
<img src="/images/healthz-outbound.png" width="800" alt="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.
Expand Down

0 comments on commit e176899

Please sign in to comment.