Search code examples
.netazurealertgrafanaazure-application-insights

Alert on specific path from API response time


We have our API hosted in Azure WebApp and all metrics go to Application insight(log analytics). Our alerting is configured on avg. response time but due to averages we are slipping important endpoints slowdowns.

We have grafana also connected to our log analytics.

We would like to put alerts on a specific path of our API, not on all request's response time.

Does anyone know a good and clear way to implement that in Application insight or Grafana?

So for example when /api/accounts avg. response time for past 10 min is > 2s we raise an alert.


Solution

  • I think you need need a query in application insights which can collect average response time of a certain url and made an alert if the avg time is > 2000ms, so you can use the query below (pls replace your url) :

    requests 
        | where name contains "Home/Index" and timestamp > ago(10m)
        | summarize AggregatedValue= avg(duration) by bin(timestamp,10m)
    

    And about how to create an alert based on Metric measurement, see this section.

    enter image description here