1. Why Architects Care About APM

  • SLI/SLO tracking — Measure request duration (p95/p99), error rate, and availability against defined targets.
  • Dependency mapping — Automatically discover which services call which databases, APIs, and queues.
  • Cost of outages — Mean-time-to-detect (MTTD) and mean-time-to-resolve (MTTR) directly tied to observability maturity.
  • Capacity planning — Trend analysis on request volume, CPU saturation, and queue depth informs scaling decisions.

2. Auto-Instrumentation vs SDK

Setup effort
Zero-code; enable via Azure portal or agent
Add NuGet/npm/pip package + config
Supported platforms
App Service, Azure Functions, AKS (auto-attach), VMs (agent)
Any .NET, Java, Node.js, Python, Go app
Telemetry depth
Requests, dependencies, exceptions (standard)
All standard + custom events, metrics, traces
Custom telemetry
Not supported
Full control: TrackEvent, TrackMetric, TrackDependency
Connection string
Set via app setting / env var
Set via app setting / env var or code
Sampling
Adaptive (default)
Adaptive, fixed-rate, or ingestion sampling

Best practice: Start with auto-instrumentation for baseline coverage; add SDK for custom business telemetry.

3. Key Telemetry Types

  • Requests — Inbound HTTP calls; track response time, status code, success/failure.
  • Dependencies — Outbound calls to SQL, HTTP APIs, Redis, Service Bus — auto-captured.
  • Exceptions — Unhandled + tracked exceptions with full stack traces.
  • Traces — Diagnostic log messages (ILogger, log4j, console) correlated to requests.
  • Custom events — Business-level signals (e.g., "OrderPlaced", "PaymentDeclined").
  • Custom metrics — Pre-aggregated numeric values (e.g., cart size, queue depth).
  • Page views / Browser — Client-side performance via JavaScript snippet.

4. Distributed Tracing & Correlation

  • operation_Id — Single correlation ID shared across ALL services in one transaction (W3C Trace Context).
  • operation_ParentId — Links child spans to their parent, forming a tree.
  • Application Insights propagates context automatically via HTTP headers (traceparent).
  • End-to-end transaction view — Visualises the full call tree with timing per span; pinpoints the slow leg instantly.
  • Cross-component correlation works across App Services, Functions, AKS, and even non-Azure services using OpenTelemetry.

5. Application Map

  • Auto-discovered topology showing components, dependencies, and external services.
  • Nodes colour-coded: 🟢 healthy, 🟡 degraded, 🔴 failing — instant failure hotspot identification.
  • Edge labels show call count, average duration, and failure rate — latency bottlenecks at a glance.
  • Click any node to drill into metrics, failures, and performance for that component.
  • Cloud role name — Set via SDK/config to distinguish microservices in the map.

6. Live Metrics & Smart Detection

  • Live Metrics Stream — Real-time (1-second latency) view of requests, failures, CPU, and memory. No sampling. Ideal for incident response.
  • Filter live stream to specific server instances or operations during active investigation.
  • Smart Detection — ML-based anomaly alerts: sudden failure rate spikes, abnormal response time growth, memory leaks.
  • Smart Detection sends proactive email notifications — no manual alert rules needed for common patterns.
  • Combine with Azure Monitor alert rules for SLO-breach notifications (e.g., p95 latency > 2s for 5 min).

7. Workspace-Based vs Classic

  • Always use workspace-based — Telemetry stored in a Log Analytics workspace; enables cross-resource queries and unified RBAC.
  • Classic (standalone) is deprecated; new resources default to workspace-based.
  • Benefits: longer retention options (up to 730 days), commitment tier discounts, integration with Sentinel and Workbooks.
  • Connection string (not instrumentation key alone) is the modern authentication method — supports regional ingestion endpoints.

💼 Real-World: Tracing a Slow Checkout Flow

An e-commerce platform reports intermittent 8-second checkout times (SLO target: 3s). The architect opens Application Map and spots a red edge between Order API and Payment Service. Drilling into the end-to-end transaction view, they filter by duration > 5000ms. The trace tree reveals: Web Frontend (200ms) → Order API (300ms) → Payment Service (6.8s) → Inventory Service (150ms). Within Payment Service, a dependency call to an external fraud-check API averages 6.2s. The team adds a 2-second timeout with circuit breaker, introduces async fraud checks for low-risk orders, and sets a Smart Detection alert on payment dependency duration. Checkout p95 drops to 1.4s.

🎯 Exam Tip

AZ-305 expects you to recommend Application Insights for any distributed tracing scenario. Key points: always choose workspace-based deployment; use connection strings (not instrumentation keys); set cloud role name to distinguish services in Application Map; and remember that sampling reduces cost but Live Metrics is never sampled. For cross-service correlation, W3C Trace Context propagation is automatic — no custom code needed.

🧪 Knowledge Check