skip to Main Content

Need to find each API Max hour usage in a given day in Azure App insight using query.
For example

API A has total hit between 1 PM to 2PM is 10, 2 PM to 3 PM is 20 and 3 PM to 4 PM is 15

API B has total hit between 1 PM to 2PM is 5, 2 PM to 3 PM is 8 and 3 PM to 4 PM is 10

API C has total hit between 1 PM to 2PM is 30, 2 PM to 3 PM is 12 and 3 PM to 4 PM is 9

Need result like this. Don’t want which hour its hitting max , even with which hour is also fine .

operation_Name MaxRequestcount
API A 20
API B 10
API C 30

requests
| summarize MaxRequestsCount=max(itemCount) by bin(timestamp, 1h) ,operation_Name 
| order by RequestsCount desc // order from highest to lower (descending)

2

Answers


  1. Chosen as BEST ANSWER
    requests
    | summarize MaxHourlyRequestCount = sum(itemCount) by bin(timestamp, 1h), operation_Name 
    | summarize MaxRequestsCount = max(MaxHourlyRequestCount) by operation_Name
    

  2. If I understood your question correctly, this should work:

    let day_start = startofday(now()); // adjust as necessary
    requests
    | where timestamp between(day_start .. 1d)
    | summarize HourlyRequestCount = sum(itemCount) by bin(timestamp, 1h), operation_Name 
    | summarize MaxRequestsCount = max(HourlyRequestCount) by operation_Name
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search