azureazure-container-appsdapr

Are Dapr Sidecar Health Checks Automatically Configured in Azure Container Apps?


According to the Dapr documentation, when API logging is enabled, all calls to the Dapr API server—including the health check endpoints—should be logged. The documentation specifies that health check logging is enabled by default (i.e., logging.apiLogging.omitHealthChecks is false).

In my Azure Container App with Dapr enabled, I have API logging turned on, but I haven't observed any logs for the health check endpoints. This leads me to wonder if Azure Container Apps might be automatically suppressing the logging of these health checks behind the scenes.

My question is:

Any clarification or pointers regarding the interplay between Dapr's sidecar health and the Azure Container Apps runtime would be greatly appreciated.


Solution

  • Configuring in Azure Container AppsHealth Checks Automatically using Dapr Sidecar

    When Dapr is enabled in Azure Container Apps, Azure automatically configures the health probes for the Dapr sidecar. This means you don’t have to manually define or configure the health probes for Dapr. Azure takes care of checking the Dapr sidecar’s /v1.0/healthz endpoint behind the scenes.

    Coming to health checks by default, only failed health check attempts are logged. If the health check succeeds, Azure does not log it.

    You don’t need to worry about custom probes for Dapr sidecar, Custom probes are only needed if your application container has its own custom health logic that you want Azure to check (e.g., /healthz on your app, not Dapr).

    I tried it on test environment by following below steps:

    This configuration need to be achieved in two different steps.

    While creating the container app, enable the Dapr in the same command itself.

    az containerapp create --name testapp --resource-group vinay-rg --environment testenv --image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest --target-port 80 --ingress external --enable-dapr --dapr-app-id testapp --dapr-app-port 80
    

    And in order to enableApilogging = true we need to use arm or bicep using rest API as CLI don't support this to be enabled through commands.

    File (test.json)

    {
      "properties": {
        "configuration": {
          "dapr": {
            "enabled": true,
            "appId": "testapp",
            "appPort": 80,
            "appProtocol": "http",
            "enableApiLogging": true
          }
        }
      }
    }
    

    Run the below command to execute the above file.

     az rest --method patch --uri “https://management.azure.com/subscriptions/Sub_ID/resourceGroups/vinay-rg/providers/Microsoft.App/containerapps/testapp?api-version=2023-05-01" --body “@test.json”.
    

    Once the above script has executed, you can check the status of dapr and API logging status using the below command:

    az containerapp show --name testapp --resource-group vinay-rg --query "properties.configuration.dapr"
    

    Output: enter image description here

    To check the log:

    az containerapp logs show --name testapp --resource-group vinay-rg --follow
    

    enter image description here

    Refer:

    https://learn.microsoft.com/en-us/azure/container-apps/enable-dapr?tabs=arm1

    https://v1-9.docs.dapr.io/operations/troubleshooting/api-logs-troubleshooting/