About Azure Metrics Requests and App Service HTTP Logs

真 川崎 216 Reputation points
2022-05-27T06:26:22.48+00:00

I want to issue an alert when a certain number of requests are exceeded.

To check the number of requests, I ran the following queries in AppService respectively.

let start=datetime("2022-05-26 00:00:00") -9h;
let end = datetime("2022-05-27 14:30:00") -9h;
AppServiceHTTPLogs
| where TimeGenerated between (start .. end)
| summarize count() by bin(TimeGenerated, 1h)

let metricName ="Requests";
let start=datetime("2022-05-26 00:00:00") -9h;
let end = datetime("2022-05-27 14:30:00") -9h;
AzureMetrics
| where TimeGenerated between (start .. end)
| where MetricName==metricName
| summarize sum(total) by bin(TimeGenerated, 1h)

Then

2022/5/26 0:00
AppServiceHTTPLogs:3115
AzureMetrics :3045

2022/5/26 1:00
AppServiceHTTPLogs:2961
AzureMetrics :2928

The numbers did not match each hour.

If you look at the description of Requests in Azure Metrics
"The total number of requests, regardless of the resulting HTTP status code."
I think it matches the number of lines output to AppServiceHTTPLogs, is that wrong?

Which is more appropriate, AppServiceHTTPLogs output rows or AzureMetrics-Requests total, when monitoring over-requests?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
{count} votes

Answer accepted by question author
  1. AnuragSingh-MSFT 21,566 Reputation points Moderator
    2022-06-01T08:31:20.887+00:00

    Hi @真 川崎 ,

    After doing some tests with a test AzureWebApp deployed, I noticed the following:

    1. The Requests in AzureMetric stores the Total Requests with aggregation also in place. Therefore, a single record here might correspond to multiple requests. In the screenshot below, the record count is 3 but Total sums up to 4. (Note the TimeGrain columns as PT1M which means that the metrics are aggregated every 1 minute).
    207485-image.png

    2. For the same AppService over the same time range, the AppServiceHTTPLogs has 4 records matching the numbers.
    207484-image.png

    Therefore, for your requirement, you can use the count of record as returned from AppServiceHTTPLogs (or even the AzureMetrics/Requests, but that will require the use of sum over Total)

    Please let me know if you have any questions.

    ---
    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.