docs-aspire icon indicating copy to clipboard operation
docs-aspire copied to clipboard

Improve clarity around app insights integration

Open davidfowl opened this issue 1 year ago • 0 comments

Based on https://github.com/dotnet/aspire/discussions/4687

This was AI generated 😄


Understanding Telemetry Options

Aspire provides flexibility in how telemetry is collected and sent to Application Insights. There are two primary approaches for integrating with Application Insights:

1. Classic Application Insights SDK

The classic Application Insights SDK is the traditional method for instrumenting .NET applications. It provides features such as:

  • Built-in telemetry collection for HTTP requests, dependencies, exceptions, and more.
  • Custom telemetry via the TelemetryClient API.

However, this SDK is not compatible with OpenTelemetry-based configurations used by Aspire’s AddServiceDefaults() method.

2. OpenTelemetry with Azure Monitor

OpenTelemetry is a modern standard for telemetry collection. Aspire uses OpenTelemetry for tracing and metrics through its AddServiceDefaults() method. With OpenTelemetry:

  • Telemetry is vendor-agnostic, allowing integration with multiple backends.
  • You can use the Azure Monitor OpenTelemetry Distro to send telemetry to Application Insights.

Key Differences:

Feature Classic Application Insights SDK OpenTelemetry with Azure Monitor
Ease of Use Requires manual setup for advanced features. Offers a more modern, standardized API.
Compatibility Not compatible with OpenTelemetry setups. Fully compatible with Aspire defaults.
Extensibility Limited to Application Insights features. Open, vendor-neutral, supports other backends.
Instrumentation Standards Application-specific APIs (e.g., TelemetryClient). OpenTelemetry standards.

For detailed guidance on each approach, see:

davidfowl avatar Dec 11 '24 06:12 davidfowl