Tool
KQL query builder
Build a latency or volume query for the Application Insights requests, dependencies
and pageViews tables without remembering the syntax. Every query counts with
sum(itemCount) and weights percentiles for sampling, so the numbers hold up when sampling is on.
Start from a library query
Your query
let lookback = 24h;
requests
| where timestamp > ago(lookback)
| summarize
requests = sum(itemCount),
percentilesw(duration, itemCount, 50, 95, 99)
by operation_Name
| order by percentile_duration_95 desc Returns one row per operation_Name for requests in the last 24 hours, with the request count and p50 (median), p95 and p99 duration in milliseconds, weighted for sampling.
What the query does
- Time range: the first line is
let lookback = 24h;, so you change the range in one place.timestampis UTC, andago()counts back from now. - Counts:
sum(itemCount)rather thancount(), because each stored row stands foritemCountitems when sampling is on. - Percentiles: one
percentilesw(duration, itemCount, 50, 95, 99)call, the weighted form ofpercentiles(), so periods sampled more heavily still count at their true size. It names its columnspercentile_duration_50,percentile_duration_95and so on;durationis in milliseconds. - Charts:
bin(timestamp, …)comes first in thebyclause, because a timechart takes its x-axis from the first column. - Grouping: only low-cardinality names such as
operation_Nameortarget; never the rawurlorid, which make one row per request. - Failures:
tostring(success) =~ "false", which works whethersuccessis stored as text or as a boolean.
The queries use the table and column names the Application Insights Logs view shows. To run one in the Log
Analytics workspace instead, switch to the workspace names: AppRequests, TimeGenerated,
DurationMs, ItemCount, OperationName and so on. The
KQL library has explained queries for common questions.
Your inputs
The builder assembles the query in your browser and does not send your choices to our server. Standard server logs and analytics still apply, as described in the privacy notice.