Analytics in Application Insights

Analytics is the powerful search feature of Application Insights. These pages describe the Analytics query language.

Queries in Analytics

A typical query is a source table followed by a series of operators separated by |.

For example, let's find out what time of day the citizens of Hyderabad try our web app. And while we're there, let's see what result codes are returned to their HTTP requests.


    requests      // Table of events that log HTTP requests.
    | where timestamp > ago(7d) and client_City == "Hyderabad"
    | summarize clients = dcount(client_IP) 
      by tod_UTC=bin(timestamp % 1d, 1h), resultCode
    | extend local_hour = (tod_UTC + 5h + 30min) % 24h + datetime("2001-01-01")

We count distinct client IP addresses, grouping them by the hour of the day over the past 7 days.

Let's display the results with the bar chart presentation, choosing to stack the results from different response codes:

Choose bar chart, x and y axes, then segmentation

Looks like our app is most popular at lunchtime and bed-time in Hyderabad. (And we should investigate those 500 codes.)

There are also powerful statistical operations:

The language has many attractive features:

  • Filter your raw app telemetry by any fields, including your custom properties and metrics.
  • Join multiple tables – correlate requests with page views, dependency calls, exceptions and log traces.
  • Powerful statistical aggregations.
  • Just as powerful as SQL, but much easier for complex queries: instead of nesting statements, you pipe the data from one elementary operation to the next.
  • Immediate and powerful visualizations.
  • Pin charts to Azure dashboards.
  • Export queries to Power BI.
  • There's a REST API that you can use to run queries programmatically, for example from Powershell.

Connect to your Application Insights data

Open Analytics from your app's overview blade in Application Insights:

Open portal.azure.com, open your Application Insights resource, and click Analytics.

Analytics

Next steps