The Aspire dashboard from the last lesson is a tool for your computer. It keeps telemetry only in memory, and when you stop aspire run, everything is gone. In Azure the Kladde needs a place where logs, metrics and traces stay for days and weeks, where you can query them and where alerts can look at them. That place is Application Insights, a part of Azure Monitor.

In this lesson you create Application Insights for the Kladde in Bicep, rebuild the ServiceDefaults so that they send there in Azure, and learn what can get lost along the way and what it costs. The Kladde sends without a key: Application Insights accepts only telemetry that is signed in with the app's managed identity.

Application Insights and Log Analytics

Application Insights has two sides:

  • The views in the portal. The Application map shows the services and their dependencies as boxes with arrows. Failures and Performance summarize failed and slow requests. Transaction search finds individual events, and the view of an End-to-end transaction shows a trace with all its spans and log lines. Live metrics shows this second's requests.
  • The data. It lives in a Log Analytics workspace, in tables like AppRequests, AppDependencies, AppTraces and AppExceptions. Today Application Insights stores in a workspace; Microsoft has retired the old “classic” resources without a workspace.

The Kladde has had a workspace since module 3.2: The Container Apps environment writes its console and system logs into it. Application Insights goes into the same workspace. Then the app's telemetry and the platform's logs are in one place, and a query can join both. You need that in lesson 3.4.6.

This is how the Kladde's spans get into the tables:

What happens in the app Table in the workspace
an incoming request (span of kind Server) AppRequests
an outgoing call: SQL, HTTP to TED, spans of your own (kind Client or Internal) AppDependencies
a log line AppTraces
a log line with an exception, an exception on a span AppExceptions
a measurement AppMetrics

That log lines land in a table called “Traces” is a legacy from the time before OpenTelemetry and confuses everyone once. Traces in the sense of OpenTelemetry are spread across AppRequests and AppDependencies.