| layout | default |
|---|---|
| title | Lab 04: Browser ↔ server correlation |
| parent | Labs |
| nav_order | 4 |
| permalink | /labs/lab-04-browser-correlation |
| description | Verify that a single operation_Id stitches together browser PageView, AJAX dependency, server request and SQL dependency. |
Timebox: 15 min — Confirm one
operation_Idend-to-end.
This lab is the payoff for Labs 02 and 03. It is a structured walkthrough of how to confirm end-to-end correlation in Application Insights, plus a debugging workflow for when correlation breaks.
By the end of this lab you will be able to:
- Trigger a deterministic, easily-findable transaction from the browser.
- Locate the resulting four spans (PageView, AJAX dependency, API request, SQL dependency) in Transaction Search.
- Run a KQL
unionquery that returns all four rows for a givenoperation_Id. - Diagnose the three most common correlation breakages: missing JS SDK, missing CORS exposure, and a misconfigured
distributedTracingMode.
In the browser, perform a search for postalCode=G1V. The search box automatically appends a unique q query-string parameter so this transaction is easy to find later.
In Application Insights → Logs:
pageViews
| where timestamp > ago(10m)
| where url contains "postalCode=G1V"
| project timestamp, name, url, operation_Id
| top 1 by timestamp descCopy the returned operation_Id into your scratch buffer.
let opId = "<paste-operation_Id-here>";
union
(pageViews | where operation_Id == opId | extend kind = "pageView"),
(dependencies | where operation_Id == opId | extend kind = "dependency"),
(requests | where operation_Id == opId | extend kind = "request")
| project timestamp, kind, name, target, duration, success
| order by timestamp ascExpected output (in order):
pageView— the search page render.dependency(Ajax) —GET $API_URI/establishments.request— the API endpoint that handled the call.dependency(SQL) — the EF Core query againstdbo.Establishments.
Comment out WithExposedHeaders in the API CORS policy from Lab 03, redeploy, and re-run Exercise 4.3. The AJAX dependency now appears under a different operation_Id from the API request — confirming the failure mode and reinforcing why exposing the W3C headers is non-negotiable.
Restore the line and confirm correlation returns.
- You can name and recognize all four span types in the union query above.
- You ran the deliberate breakage and saw the orphaned AJAX dependency.
- You restored the CORS exposure and confirmed correlation returns.
- You can articulate the difference between
operation_Id(per trace) andoperation_ParentId(per span).
End-to-end correlation is now demonstrably working. Continue with Lab 05: Dashboards, KQL, alerts to turn this telemetry into a Workbook, three KQL queries and one alert rule.