diff --git a/samples/web-app-app-configuration/dotnet/README.md b/samples/web-app-app-configuration/dotnet/README.md index 4530a33..3ecb8ce 100644 --- a/samples/web-app-app-configuration/dotnet/README.md +++ b/samples/web-app-app-configuration/dotnet/README.md @@ -436,7 +436,7 @@ The emulator serves an emulated Azure portal at `http://localhost:4566/_localsta ### Delivery times -On the emulator the records are queryable within seconds, and the aggregated ones (`AACHttpRequest` and `AzureMetrics`) once their one-minute window is over. On Azure the records take minutes, and the first records of a new diagnostic setting can take [up to 90 minutes](https://learn.microsoft.com/azure/azure-monitor/data-collection/diagnostic-settings#expected-latency-after-creating-a-diagnostic-setting): run the queries again later, or raise `RETRY_COUNT` for the script. The exported platform metrics (`AzureMetrics`) are the exception: Azure exports them late and irregularly, so on Azure `query-logs-and-metrics.sh` reads them once, shows those that arrived and notes how many are still missing, without failing. A new setting can also take a while before it delivers anything, and on Azure the records of what the application did while it started, such as its start-up console lines or its secret reads in the key vault, can then be missing for good: once the workspace receives records, `az webapp restart --name local-webapp-test --resource-group local-rg` starts the application again, and the records of the new start arrive. +On the emulator the records are queryable within seconds, and the aggregated ones (`AACHttpRequest` and `AzureMetrics`) once their one-minute window is over. On Azure the records take minutes, and the first records of a new diagnostic setting can take [up to 90 minutes](https://learn.microsoft.com/azure/azure-monitor/data-collection/diagnostic-settings#expected-latency-after-creating-a-diagnostic-setting): run the queries again later, or raise `RETRY_COUNT` for the script. The exported platform metrics (`AzureMetrics`) are the exception: Azure exports them late and irregularly, so on Azure `query-logs-and-metrics.sh` reads them once, shows those that arrived and notes how many are still missing, without failing. A new setting can also take a while before it delivers anything, and on Azure the records of what the application did while it started, such as its start-up console lines, its reads of the App Configuration store or its secret reads in the key vault, can then be missing for good: once the workspace receives records, `az webapp restart --name local-webapp-test --resource-group local-rg` starts the application again, and the records of the new start arrive. ## Troubleshooting diff --git a/samples/web-app-app-configuration/dotnet/scripts/query-logs-and-metrics.sh b/samples/web-app-app-configuration/dotnet/scripts/query-logs-and-metrics.sh index bef64cf..af7a2c5 100755 --- a/samples/web-app-app-configuration/dotnet/scripts/query-logs-and-metrics.sh +++ b/samples/web-app-app-configuration/dotnet/scripts/query-logs-and-metrics.sh @@ -397,16 +397,10 @@ query_workspace \ "AppServicePlatformLogs | project TimeGenerated, Level, Message | order by TimeGenerated desc | take 10" \ "[].{Time:TimeGenerated,Level:Level,Message:Message}" -# The requests to the store (AACHttpRequest), each record aggregating the requests of one method and status code: among -# them the GET with which the app reads its key-values, made by the managed identity of the web app (ClientObjectId) -query_workspace \ - "Requests to the [$APP_CONFIG_NAME] App Configuration store (AACHttpRequest)" \ - "AACHttpRequest | project TimeGenerated, Method, StatusCode, HitCount, ClientObjectId, RequestURI | order by TimeGenerated desc | take 10" \ - "[].{Time:TimeGenerated,Method:Method,Status:StatusCode,Hits:HitCount,Caller:ClientObjectId,Uri:RequestURI}" - -# Azure can drop for good the records of a new diagnostic setting's first minutes, among them the secret reads of -# the web app's start, so the web app is restarted and called again: it reads its secrets anew -echo -e "\nRestarting the [$WEB_APP_NAME] web app, so that it reads its two secrets again..." +# The web app reads its key-values from the store and its two secrets from the key vault only when it starts, and Azure +# can drop for good the records of a new diagnostic setting's first minutes, among them those reads, so the web app is +# restarted before the two queries that look for them: it reads its key-values and secrets anew +echo -e "\nRestarting the [$WEB_APP_NAME] web app, so that it reads its key-values and its two secrets again..." az webapp restart \ --name "$WEB_APP_NAME" \ --resource-group "$RESOURCE_GROUP_NAME" \ @@ -420,6 +414,13 @@ else fi wait_for_web_app "https://$WEB_APP_HOST_NAME/" +# The requests to the store (AACHttpRequest), each record aggregating the requests of one method and status code: among +# them the GET with which the app reads its key-values, made by the managed identity of the web app (ClientObjectId) +query_workspace \ + "Requests to the [$APP_CONFIG_NAME] App Configuration store (AACHttpRequest)" \ + "AACHttpRequest | project TimeGenerated, Method, StatusCode, HitCount, ClientObjectId, RequestURI | order by TimeGenerated desc | take 10" \ + "[].{Time:TimeGenerated,Method:Method,Status:StatusCode,Hits:HitCount,Caller:ClientObjectId,Uri:RequestURI}" + # The reads of the pg-user and pg-password secrets that resolved the two Key Vault references (AZKVAuditLogs) query_workspace \ "Secret reads in the [$KEY_VAULT_NAME] key vault (AZKVAuditLogs)" \ diff --git a/samples/web-app-app-configuration/python/README.md b/samples/web-app-app-configuration/python/README.md index 210d69d..808ab64 100644 --- a/samples/web-app-app-configuration/python/README.md +++ b/samples/web-app-app-configuration/python/README.md @@ -436,7 +436,7 @@ The emulator serves an emulated Azure portal at `http://localhost:4566/_localsta ### Delivery times -On the emulator the records are queryable within seconds, and the aggregated ones (`AACHttpRequest` and `AzureMetrics`) once their one-minute window is over. On Azure the records take minutes, and the first records of a new diagnostic setting can take [up to 90 minutes](https://learn.microsoft.com/azure/azure-monitor/data-collection/diagnostic-settings#expected-latency-after-creating-a-diagnostic-setting): run the queries again later, or raise `RETRY_COUNT` for the script. The exported platform metrics (`AzureMetrics`) are the exception: Azure exports them late and irregularly, so on Azure `query-logs-and-metrics.sh` reads them once, shows those that arrived and notes how many are still missing, without failing. A new setting can also take a while before it delivers anything, and on Azure the records of what the application did while it started, such as its start-up console lines or its secret reads in the key vault, can then be missing for good: once the workspace receives records, `az webapp restart --name local-webapp-test --resource-group local-rg` starts the application again, and the records of the new start arrive. +On the emulator the records are queryable within seconds, and the aggregated ones (`AACHttpRequest` and `AzureMetrics`) once their one-minute window is over. On Azure the records take minutes, and the first records of a new diagnostic setting can take [up to 90 minutes](https://learn.microsoft.com/azure/azure-monitor/data-collection/diagnostic-settings#expected-latency-after-creating-a-diagnostic-setting): run the queries again later, or raise `RETRY_COUNT` for the script. The exported platform metrics (`AzureMetrics`) are the exception: Azure exports them late and irregularly, so on Azure `query-logs-and-metrics.sh` reads them once, shows those that arrived and notes how many are still missing, without failing. A new setting can also take a while before it delivers anything, and on Azure the records of what the application did while it started, such as its start-up console lines, its reads of the App Configuration store or its secret reads in the key vault, can then be missing for good: once the workspace receives records, `az webapp restart --name local-webapp-test --resource-group local-rg` starts the application again, and the records of the new start arrive. ## Troubleshooting diff --git a/samples/web-app-app-configuration/python/scripts/query-logs-and-metrics.sh b/samples/web-app-app-configuration/python/scripts/query-logs-and-metrics.sh index bef64cf..af7a2c5 100755 --- a/samples/web-app-app-configuration/python/scripts/query-logs-and-metrics.sh +++ b/samples/web-app-app-configuration/python/scripts/query-logs-and-metrics.sh @@ -397,16 +397,10 @@ query_workspace \ "AppServicePlatformLogs | project TimeGenerated, Level, Message | order by TimeGenerated desc | take 10" \ "[].{Time:TimeGenerated,Level:Level,Message:Message}" -# The requests to the store (AACHttpRequest), each record aggregating the requests of one method and status code: among -# them the GET with which the app reads its key-values, made by the managed identity of the web app (ClientObjectId) -query_workspace \ - "Requests to the [$APP_CONFIG_NAME] App Configuration store (AACHttpRequest)" \ - "AACHttpRequest | project TimeGenerated, Method, StatusCode, HitCount, ClientObjectId, RequestURI | order by TimeGenerated desc | take 10" \ - "[].{Time:TimeGenerated,Method:Method,Status:StatusCode,Hits:HitCount,Caller:ClientObjectId,Uri:RequestURI}" - -# Azure can drop for good the records of a new diagnostic setting's first minutes, among them the secret reads of -# the web app's start, so the web app is restarted and called again: it reads its secrets anew -echo -e "\nRestarting the [$WEB_APP_NAME] web app, so that it reads its two secrets again..." +# The web app reads its key-values from the store and its two secrets from the key vault only when it starts, and Azure +# can drop for good the records of a new diagnostic setting's first minutes, among them those reads, so the web app is +# restarted before the two queries that look for them: it reads its key-values and secrets anew +echo -e "\nRestarting the [$WEB_APP_NAME] web app, so that it reads its key-values and its two secrets again..." az webapp restart \ --name "$WEB_APP_NAME" \ --resource-group "$RESOURCE_GROUP_NAME" \ @@ -420,6 +414,13 @@ else fi wait_for_web_app "https://$WEB_APP_HOST_NAME/" +# The requests to the store (AACHttpRequest), each record aggregating the requests of one method and status code: among +# them the GET with which the app reads its key-values, made by the managed identity of the web app (ClientObjectId) +query_workspace \ + "Requests to the [$APP_CONFIG_NAME] App Configuration store (AACHttpRequest)" \ + "AACHttpRequest | project TimeGenerated, Method, StatusCode, HitCount, ClientObjectId, RequestURI | order by TimeGenerated desc | take 10" \ + "[].{Time:TimeGenerated,Method:Method,Status:StatusCode,Hits:HitCount,Caller:ClientObjectId,Uri:RequestURI}" + # The reads of the pg-user and pg-password secrets that resolved the two Key Vault references (AZKVAuditLogs) query_workspace \ "Secret reads in the [$KEY_VAULT_NAME] key vault (AZKVAuditLogs)" \