Search code examples
azureazure-application-insightsazure-monitoring

Azure Response Time Monitoring per request with a range


Very new to azure application insight,

I want to group all the request with respective duration. For example, I want to put the response time which is in between 0-3 second as "Green/Color", 3-5 second in "Yellow/Color" and greater than 5 should be "Red/Color".

I am using the below Kusto Query language, which need to enhanced

requests | where timestamp > ago(2h)


Solution

  • You can use the case function combined with the fact that the request duration is stored in the duration field in milliseconds:

    requests  
    | where timestamp > ago(2h)
    | extend color = case(duration <= 3000, "Green/Color", 
                           duration <= 5000, "Yellow/Color", 
                           "Red/Color")
    | project timestamp, url, resultCode, color, duration