@azure/mcp-linux-arm64 2.0.0-beta.30 → 2.0.0-beta.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/Instrumentation/Resources/api-reference/dotnet/AddApplicationInsightsTelemetryWorkerService.md +115 -0
  2. package/dist/Instrumentation/Resources/api-reference/dotnet/ApplicationInsightsWeb.md +103 -0
  3. package/dist/Instrumentation/Resources/api-reference/dotnet/ConfigureOpenTelemetryProvider.md +23 -0
  4. package/dist/Instrumentation/Resources/api-reference/dotnet/ConsoleExporter.md +47 -0
  5. package/dist/Instrumentation/Resources/api-reference/dotnet/EntityFrameworkInstrumentation.md +56 -0
  6. package/dist/Instrumentation/Resources/api-reference/dotnet/HttpInstrumentation.md +109 -0
  7. package/dist/Instrumentation/Resources/api-reference/dotnet/LogProcessors.md +2 -0
  8. package/dist/Instrumentation/Resources/api-reference/dotnet/OtlpExporter.md +88 -0
  9. package/dist/Instrumentation/Resources/api-reference/dotnet/RedisInstrumentation.md +63 -0
  10. package/dist/Instrumentation/Resources/api-reference/dotnet/SqlClientInstrumentation.md +53 -0
  11. package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryClient.md +122 -0
  12. package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryConfigurationBuilder.md +173 -0
  13. package/dist/Instrumentation/Resources/concepts/dotnet/appinsights-aspnetcore.md +113 -0
  14. package/dist/Instrumentation/Resources/concepts/dotnet/aspnet-classic-appinsights.md +95 -0
  15. package/dist/Instrumentation/Resources/concepts/dotnet/azure-monitor-distro.md +1 -1
  16. package/dist/Instrumentation/Resources/concepts/dotnet/opentelemetry-pipeline.md +1 -1
  17. package/dist/Instrumentation/Resources/concepts/nodejs/azure-monitor-overview.md +106 -0
  18. package/dist/Instrumentation/Resources/concepts/nodejs/opentelemetry-pipeline.md +201 -0
  19. package/dist/Instrumentation/Resources/concepts/python/azure-monitor-overview.md +122 -0
  20. package/dist/Instrumentation/Resources/concepts/python/opentelemetry-pipeline.md +154 -0
  21. package/dist/Instrumentation/Resources/examples/dotnet/aspnet-classic-setup.md +80 -0
  22. package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-distro-setup.md +156 -0
  23. package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-setup.md +34 -30
  24. package/dist/Instrumentation/Resources/examples/dotnet/workerservice-setup.md +154 -0
  25. package/dist/Instrumentation/Resources/examples/nodejs/bunyan-setup.md +301 -0
  26. package/dist/Instrumentation/Resources/examples/nodejs/console-setup.md +284 -0
  27. package/dist/Instrumentation/Resources/examples/nodejs/express-setup.md +169 -0
  28. package/dist/Instrumentation/Resources/examples/nodejs/fastify-setup.md +237 -0
  29. package/dist/Instrumentation/Resources/examples/nodejs/langchain-js-setup.md +310 -0
  30. package/dist/Instrumentation/Resources/examples/nodejs/mongodb-setup.md +185 -0
  31. package/dist/Instrumentation/Resources/examples/nodejs/mysql-setup.md +231 -0
  32. package/dist/Instrumentation/Resources/examples/nodejs/nestjs-setup.md +184 -0
  33. package/dist/Instrumentation/Resources/examples/nodejs/nextjs-setup.md +320 -0
  34. package/dist/Instrumentation/Resources/examples/nodejs/postgres-setup.md +147 -0
  35. package/dist/Instrumentation/Resources/examples/nodejs/redis-setup.md +198 -0
  36. package/dist/Instrumentation/Resources/examples/nodejs/winston-setup.md +260 -0
  37. package/dist/Instrumentation/Resources/examples/python/console-setup.md +392 -0
  38. package/dist/Instrumentation/Resources/examples/python/django-setup.md +269 -0
  39. package/dist/Instrumentation/Resources/examples/python/fastapi-setup.md +256 -0
  40. package/dist/Instrumentation/Resources/examples/python/flask-setup.md +218 -0
  41. package/dist/Instrumentation/Resources/examples/python/genai-setup.md +214 -0
  42. package/dist/Instrumentation/Resources/examples/python/generic-setup.md +164 -0
  43. package/dist/Instrumentation/Resources/migration/dotnet/aad-authentication-migration.md +150 -0
  44. package/dist/Instrumentation/Resources/migration/dotnet/appinsights-2x-to-3x-code-migration.md +30 -0
  45. package/dist/Instrumentation/Resources/migration/dotnet/aspnet-classic-2x-to-3x-code-migration.md +190 -0
  46. package/dist/Instrumentation/Resources/migration/dotnet/console-2x-to-3x-code-migration.md +106 -0
  47. package/dist/Instrumentation/Resources/migration/dotnet/ilogger-migration.md +54 -0
  48. package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-code-migration.md +126 -0
  49. package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-no-code-change.md +102 -0
  50. package/dist/azmcp +0 -0
  51. package/package.json +3 -3
@@ -0,0 +1,150 @@
1
+ ---
2
+ title: AAD Authentication Migration (2.x to 3.x)
3
+ category: migration
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # AAD Authentication Migration (2.x → 3.x)
8
+
9
+ ## What changed
10
+
11
+ In 2.x, `SetAzureTokenCredential(object)` existed on `TelemetryConfiguration` but accepted an `object` parameter — it used reflection internally to avoid a hard dependency on `Azure.Core`. Some teams also used `IConfigureOptions<TelemetryConfiguration>` workarounds to configure credentials in DI scenarios.
12
+
13
+ In 3.x, the method signature changed to **strongly typed** and new DI-friendly options were added:
14
+ - `TelemetryConfiguration.SetAzureTokenCredential(TokenCredential)` — **Signature changed** from `object` to `TokenCredential`. Must be called before a `TelemetryClient` is created from that configuration.
15
+ - `ApplicationInsightsServiceOptions.Credential` — **New in 3.x**. Preferred for DI scenarios (ASP.NET Core / Worker Service). Set your `TokenCredential` directly in the options lambda.
16
+
17
+ Other key changes:
18
+ - `TelemetryConfiguration.Active` — **Removed**. Use `TelemetryConfiguration.CreateDefault()` instead. Note: `CreateDefault()` now returns an internal static configuration (singleton-like) rather than a new instance each time.
19
+
20
+ ---
21
+
22
+ ## DI Scenario (ASP.NET Core / Worker Service)
23
+
24
+ In 2.x, AAD auth in DI apps was commonly configured via `IConfigureOptions<TelemetryConfiguration>` workarounds. In 3.x, use the new `Credential` property on `ApplicationInsightsServiceOptions` directly — simpler and no extra class needed.
25
+
26
+ ### Before (2.x — IConfigureOptions pattern)
27
+
28
+ ```csharp
29
+ using Microsoft.ApplicationInsights.Extensibility;
30
+ using Microsoft.Extensions.Options;
31
+ using Azure.Identity;
32
+
33
+ public class TelemetryConfigurationEnricher : IConfigureOptions<TelemetryConfiguration>
34
+ {
35
+ public void Configure(TelemetryConfiguration options)
36
+ {
37
+ // 2.x signature: SetAzureTokenCredential(object) — accepts object, uses reflection
38
+ object credential = new DefaultAzureCredential();
39
+ options.SetAzureTokenCredential(credential);
40
+ }
41
+ }
42
+
43
+ // In Startup.cs / Program.cs:
44
+ services.AddSingleton<IConfigureOptions<TelemetryConfiguration>, TelemetryConfigurationEnricher>();
45
+ services.AddApplicationInsightsTelemetry();
46
+ ```
47
+
48
+ ### After (3.x — Credential property on options)
49
+
50
+ ```csharp
51
+ using Microsoft.Extensions.DependencyInjection;
52
+ using Microsoft.ApplicationInsights.AspNetCore.Extensions;
53
+ using Azure.Identity;
54
+
55
+ builder.Services.AddApplicationInsightsTelemetry(options =>
56
+ {
57
+ options.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
58
+ options.Credential = new DefaultAzureCredential();
59
+ });
60
+ ```
61
+
62
+ ### Migration steps (DI)
63
+
64
+ 1. **Remove the `IConfigureOptions<TelemetryConfiguration>` class** that calls `SetAzureTokenCredential()` (e.g., `TelemetryConfigurationEnricher`). Delete the entire class file if it only handled AAD auth.
65
+
66
+ 2. **Remove the DI registration** for the configurator:
67
+ ```csharp
68
+ // Delete this line:
69
+ services.AddSingleton<IConfigureOptions<TelemetryConfiguration>, TelemetryConfigurationEnricher>();
70
+ ```
71
+
72
+ 3. **Set the `Credential` property** in your `AddApplicationInsightsTelemetry()` options:
73
+ ```csharp
74
+ builder.Services.AddApplicationInsightsTelemetry(options =>
75
+ {
76
+ options.Credential = new DefaultAzureCredential();
77
+ });
78
+ ```
79
+
80
+ 4. For **Worker Service** apps, the same applies to `AddApplicationInsightsTelemetryWorkerService()`:
81
+ ```csharp
82
+ services.AddApplicationInsightsTelemetryWorkerService(options =>
83
+ {
84
+ options.Credential = new DefaultAzureCredential();
85
+ });
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Non-DI Scenario (Console apps, manual TelemetryConfiguration)
91
+
92
+ For apps that create `TelemetryConfiguration` directly (console apps, batch jobs, etc.), the new `SetAzureTokenCredential` method provides built-in AAD support. The main breaking change is that `TelemetryConfiguration.Active` is removed.
93
+
94
+ ### Before (2.x — TelemetryConfiguration.Active)
95
+
96
+ ```csharp
97
+ using Microsoft.ApplicationInsights;
98
+ using Microsoft.ApplicationInsights.Extensibility;
99
+ using Azure.Identity;
100
+
101
+ var config = TelemetryConfiguration.Active;
102
+ config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
103
+ // 2.x signature: SetAzureTokenCredential(object) — accepts object, uses reflection
104
+ config.SetAzureTokenCredential((object)new DefaultAzureCredential());
105
+
106
+ var client = new TelemetryClient(config);
107
+ ```
108
+
109
+ ### After (3.x — CreateDefault)
110
+
111
+ ```csharp
112
+ using Microsoft.ApplicationInsights;
113
+ using Microsoft.ApplicationInsights.Extensibility;
114
+ using Azure.Identity;
115
+
116
+ var config = TelemetryConfiguration.CreateDefault();
117
+ config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
118
+ // 3.x signature: SetAzureTokenCredential(TokenCredential) — strongly typed
119
+ config.SetAzureTokenCredential(new DefaultAzureCredential());
120
+
121
+ var client = new TelemetryClient(config);
122
+ ```
123
+
124
+ ### Migration steps (non-DI)
125
+
126
+ 1. **Replace `TelemetryConfiguration.Active`** with `TelemetryConfiguration.CreateDefault()` — the `Active` static property is removed in 3.x. Note that `CreateDefault()` returns an internal static configuration (singleton-like) rather than creating a new instance.
127
+
128
+ 2. **Use `SetAzureTokenCredential(TokenCredential)`** — the parameter type changed from `object` (2.x) to strongly typed `TokenCredential` (3.x). If your code previously cast to `object`, remove the cast. Call it **before** creating a `TelemetryClient` from that configuration.
129
+
130
+ 3. If using a custom `TokenCredential` (e.g., `ManagedIdentityCredential` with a specific client ID), pass it directly:
131
+ ```csharp
132
+ var credential = new ManagedIdentityCredential("your-client-id");
133
+ var config = TelemetryConfiguration.CreateDefault();
134
+ config.SetAzureTokenCredential(credential);
135
+ var client = new TelemetryClient(config);
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Notes
141
+
142
+ - The `Azure.Identity` package is still required — no change there.
143
+ - If you previously used `SetAzureTokenCredential` conditionally (e.g., only in certain environments), apply the same condition when setting `options.Credential` (DI) or calling `SetAzureTokenCredential` (non-DI).
144
+ - Both paths ultimately set `AzureMonitorExporterOptions.Credential` under the hood.
145
+
146
+ ## See also
147
+
148
+ - [AddApplicationInsightsTelemetry API reference](learn://api-reference/dotnet/AddApplicationInsightsTelemetry.md) — full list of `ApplicationInsightsServiceOptions` properties
149
+ - [UseAzureMonitor API reference](learn://api-reference/dotnet/UseAzureMonitor.md) — if migrating to Azure Monitor OpenTelemetry Distro instead
150
+ - [App Insights 2.x → 3.x code migration](learn://migration/dotnet/appinsights-2x-to-3x-code-migration.md) — full migration guide
@@ -102,6 +102,36 @@ Or set `APPLICATIONINSIGHTS_CONNECTION_STRING` as an environment variable and ca
102
102
  | `client.InstrumentationKey` | **Removed**. Use `TelemetryConfiguration.ConnectionString`. |
103
103
  | `TrackTrace`, `TrackMetric`, `TrackRequest`, `TrackDependency` (full overload), `Flush` | **Unchanged** — no action needed. |
104
104
 
105
+ ## Middleware telemetry access
106
+
107
+ In 2.x, middleware could access `RequestTelemetry` via `HttpContext.Features`:
108
+
109
+ ```csharp
110
+ // 2.x
111
+ var requestTelemetry = context.Features.Get<RequestTelemetry>();
112
+ requestTelemetry?.Properties.Add("ResponseBody", responseBody);
113
+ ```
114
+
115
+ In 3.x, `RequestTelemetry` is no longer placed in `HttpContext.Features`. Use `Activity.Current` instead:
116
+
117
+ ```csharp
118
+ // 3.x
119
+ using System.Diagnostics;
120
+
121
+ var activity = Activity.Current;
122
+ activity?.SetTag("ResponseBody", responseBody);
123
+ ```
124
+
125
+ This applies to any code that accessed `RequestTelemetry` or `DependencyTelemetry` via `HttpContext.Features.Get<T>()`.
126
+
127
+ ## Manually constructed telemetry objects
128
+
129
+ Telemetry types (`RequestTelemetry`, `DependencyTelemetry`, `TraceTelemetry`, `EventTelemetry`, `ExceptionTelemetry`, `MetricTelemetry`, `AvailabilityTelemetry`) still exist in 3.x and can be passed to `TelemetryClient.Track*(...)`. However:
130
+
131
+ - `ISupportProperties` — **Removed**. Use the typed `Properties` dictionary directly on each telemetry class.
132
+ - Type checks (`telemetry is RequestTelemetry`) in custom middleware or filters — these still compile but may not match auto-collected telemetry in contexts where the 3.x SDK uses `Activity` internally. Prefer `Activity.Current?.SetTag()` for enrichment.
133
+ - `new DependencyTelemetry(...)` with `StartOperation<DependencyTelemetry>()` — **Still works**. The dependency is correlated automatically.
134
+
105
135
  ## Migration steps
106
136
 
107
137
  1. Update the package:
@@ -0,0 +1,190 @@
1
+ ---
2
+ title: Classic ASP.NET 2.x to 3.x Migration
3
+ category: migration
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # Classic ASP.NET 2.x → 3.x Code Migration
8
+
9
+ ## What changed
10
+
11
+ 3.x is built on OpenTelemetry internally. The NuGet package name stays the same — `Microsoft.ApplicationInsights.Web` — but the internal architecture changed. `applicationinsights.config` format is simplified, satellite packages are removed, and extensibility uses OpenTelemetry processors via `ConfigureOpenTelemetryBuilder`.
12
+
13
+ Key changes:
14
+ - `<InstrumentationKey>` → `<ConnectionString>` (connection string is **required** — 3.x throws without it)
15
+ - `<TelemetryInitializers>`, `<TelemetryModules>`, `<TelemetryProcessors>` sections → removed entirely
16
+ - `<TelemetryChannel>` section → removed (export managed by OpenTelemetry)
17
+ - 12 satellite packages → removed (functionality built into the main package)
18
+ - `TelemetryConfiguration.Active` → `TelemetryConfiguration.CreateDefault()` (returns static singleton in 3.x)
19
+ - Minimum .NET Framework: 4.5.2 → **4.6.2**
20
+ - Custom initializers/processors → OpenTelemetry processors via `ConfigureOpenTelemetryBuilder`
21
+
22
+ ## applicationinsights.config — before / after
23
+
24
+ **2.x:**
25
+ ```xml
26
+ <?xml version="1.0" encoding="utf-8"?>
27
+ <ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
28
+ <InstrumentationKey>00000000-0000-0000-0000-000000000000</InstrumentationKey>
29
+ <TelemetryInitializers>
30
+ <Add Type="Microsoft.ApplicationInsights.Web.WebTestTelemetryInitializer, Microsoft.AI.Web" />
31
+ <Add Type="Microsoft.ApplicationInsights.Web.SyntheticUserAgentTelemetryInitializer, Microsoft.AI.Web">
32
+ <Filters>search|spider|crawl|Bot|Monitor</Filters>
33
+ </Add>
34
+ <!-- ... more initializers ... -->
35
+ </TelemetryInitializers>
36
+ <TelemetryModules>
37
+ <Add Type="Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule, Microsoft.AI.Web" />
38
+ <Add Type="Microsoft.ApplicationInsights.Web.ExceptionTrackingTelemetryModule, Microsoft.AI.Web" />
39
+ <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector" />
40
+ <!-- ... more modules ... -->
41
+ </TelemetryModules>
42
+ <TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel">
43
+ <DeveloperMode>false</DeveloperMode>
44
+ </TelemetryChannel>
45
+ </ApplicationInsights>
46
+ ```
47
+
48
+ **3.x:**
49
+ ```xml
50
+ <?xml version="1.0" encoding="utf-8"?>
51
+ <ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
52
+ <ConnectionString>InstrumentationKey=...;IngestionEndpoint=https://dc.applicationinsights.azure.com/</ConnectionString>
53
+ <TracesPerSecond>5.0</TracesPerSecond>
54
+ <EnableTraceBasedLogsSampler>true</EnableTraceBasedLogsSampler>
55
+ <EnableQuickPulseMetricStream>true</EnableQuickPulseMetricStream>
56
+ <EnablePerformanceCounterCollectionModule>true</EnablePerformanceCounterCollectionModule>
57
+ <EnableDependencyTrackingTelemetryModule>true</EnableDependencyTrackingTelemetryModule>
58
+ <EnableRequestTrackingTelemetryModule>true</EnableRequestTrackingTelemetryModule>
59
+ <AddAutoCollectedMetricExtractor>true</AddAutoCollectedMetricExtractor>
60
+ </ApplicationInsights>
61
+ ```
62
+
63
+ ## Web.config changes
64
+
65
+ **Remove** `TelemetryCorrelationHttpModule` (OpenTelemetry handles correlation natively).
66
+
67
+ **Keep** `ApplicationInsightsHttpModule` — still needed in 3.x.
68
+
69
+ **Add** `TelemetryHttpModule` (from `OpenTelemetry.Instrumentation.AspNet`) — added automatically by NuGet install.
70
+
71
+ ## Satellite packages to remove
72
+
73
+ These packages are no longer needed — their functionality is built into `Microsoft.ApplicationInsights.Web` 3.x. **Remove in this order** (dependents before dependencies):
74
+
75
+ 1. `Microsoft.ApplicationInsights.WindowsServer`
76
+ 2. `Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel`
77
+ 3. `Microsoft.ApplicationInsights.DependencyCollector`
78
+ 4. `Microsoft.ApplicationInsights.PerfCounterCollector`
79
+ 5. `Microsoft.ApplicationInsights.Agent.Intercept`
80
+ 6. `Microsoft.AspNet.TelemetryCorrelation`
81
+
82
+ Also remove if present (skip any not in packages.config):
83
+ - `Microsoft.ApplicationInsights.EventCounterCollector`
84
+ - `Microsoft.Extensions.Logging.ApplicationInsights`
85
+ - `Microsoft.ApplicationInsights.Log4NetAppender`
86
+ - `Microsoft.ApplicationInsights.TraceListener`
87
+ - `Microsoft.ApplicationInsights.DiagnosticSourceListener`
88
+ - `Microsoft.ApplicationInsights.EtwCollector`
89
+ - `Microsoft.ApplicationInsights.EventSourceListener`
90
+
91
+ ## TelemetryConfiguration changes
92
+
93
+ | 2.x Pattern | 3.x Replacement |
94
+ |---|---|
95
+ | `TelemetryConfiguration.Active` | `TelemetryConfiguration.CreateDefault()` (returns static singleton) |
96
+ | `new TelemetryConfiguration(ikey)` | `TelemetryConfiguration.CreateDefault()` + set `ConnectionString` |
97
+ | `config.InstrumentationKey = "..."` | `config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=..."` |
98
+ | `config.TelemetryInitializers.Add(...)` | Use `ConfigureOpenTelemetryBuilder` — see below |
99
+ | `config.TelemetryProcessorChainBuilder` | Use `ConfigureOpenTelemetryBuilder` — see below |
100
+ | `config.TelemetryChannel` | Removed — export managed by OpenTelemetry |
101
+ | `config.TelemetrySinks` | Removed — use OpenTelemetry exporters |
102
+
103
+ ## Custom processor migration (non-DI)
104
+
105
+ In classic ASP.NET, use `ConfigureOpenTelemetryBuilder` on `TelemetryConfiguration` in `Global.asax.cs`:
106
+
107
+ ```csharp
108
+ using Microsoft.ApplicationInsights;
109
+ using Microsoft.ApplicationInsights.Extensibility;
110
+ using OpenTelemetry.Trace;
111
+ using OpenTelemetry.Logs;
112
+ using OpenTelemetry.Resources;
113
+
114
+ public class MvcApplication : HttpApplication
115
+ {
116
+ public static TelemetryClient TelemetryClient { get; private set; }
117
+
118
+ protected void Application_Start()
119
+ {
120
+ var config = TelemetryConfiguration.CreateDefault();
121
+ config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
122
+ config.ConfigureOpenTelemetryBuilder(otel =>
123
+ {
124
+ otel.WithTracing(tracing =>
125
+ {
126
+ tracing.AddProcessor<MyEnrichmentProcessor>();
127
+ tracing.AddProcessor<MyFilterProcessor>();
128
+ });
129
+ otel.ConfigureResource(r => r.AddService("MyWebApp"));
130
+ });
131
+
132
+ TelemetryClient = new TelemetryClient(config);
133
+
134
+ AreaRegistration.RegisterAllAreas();
135
+ RouteConfig.RegisterRoutes(RouteTable.Routes);
136
+ }
137
+
138
+ protected void Application_End()
139
+ {
140
+ TelemetryClient?.Flush();
141
+ System.Threading.Tasks.Task.Delay(1000).Wait();
142
+ }
143
+ }
144
+ ```
145
+
146
+ > **Important:** Create a **single static** `TelemetryClient` instance in `Application_Start`. Do not create per-request or per-controller instances — this causes memory leaks and duplicate telemetry. `TelemetryConfiguration.CreateDefault()` returns a singleton that is shared with the `ApplicationInsightsHttpModule`.
147
+
148
+ See TelemetryConfigurationBuilder.md for full API details.
149
+
150
+ ## Sampling changes
151
+
152
+ - Per-type sampling (e.g. exclude exceptions from sampling) is **no longer supported**
153
+ - Default: rate-limited at 5 traces/sec via `<TracesPerSecond>`
154
+ - Fixed-rate: `<SamplingRatio>0.25</SamplingRatio>` (25%)
155
+ - Custom OTel samplers not supported with 3.x shim
156
+
157
+ ## TelemetryClient changes
158
+
159
+ See TelemetryClient.md for full breaking changes. Key items:
160
+ - `TrackPageView` — removed entirely
161
+ - `TrackEvent`/`TrackException`/`TrackAvailability` — metrics dict parameter removed
162
+ - Parameterless `new TelemetryClient()` — removed, use `new TelemetryClient(TelemetryConfiguration.CreateDefault())`
163
+ - `client.InstrumentationKey` — removed
164
+ - Create a **single static instance** — do not create per-request (see processor migration section above)
165
+
166
+ ## Migration steps
167
+
168
+ 1. Check .NET Framework target — must be **4.6.2** or later
169
+ 2. Upgrade `Microsoft.ApplicationInsights.Web` to 3.x via Package Manager Console: `Update-Package Microsoft.ApplicationInsights.Web`
170
+ 3. Remove satellite packages via Package Manager Console in this order (dependents before dependencies):
171
+ - `Microsoft.ApplicationInsights.WindowsServer`
172
+ - `Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel`
173
+ - `Microsoft.ApplicationInsights.DependencyCollector`
174
+ - `Microsoft.ApplicationInsights.PerfCounterCollector`
175
+ - `Microsoft.ApplicationInsights.Agent.Intercept`
176
+ - `Microsoft.AspNet.TelemetryCorrelation`
177
+ 4. Rewrite `applicationinsights.config` to 3.x format (remove all `<TelemetryInitializers>`, `<TelemetryModules>`, `<TelemetryProcessors>`, `<TelemetryChannel>` sections; add `<ConnectionString>` and feature flags)
178
+ 5. Update `Web.config` — remove `TelemetryCorrelationHttpModule`, verify `TelemetryHttpModule` present
179
+ 6. Replace `TelemetryConfiguration.Active` with `TelemetryConfiguration.CreateDefault()` in code
180
+ 7. Create a single static `TelemetryClient` in `Application_Start`, flush in `Application_End`
181
+ 8. Migrate custom `ITelemetryInitializer`/`ITelemetryProcessor` to OpenTelemetry processors via `ConfigureOpenTelemetryBuilder`
182
+ 9. Fix TelemetryClient breaking calls (TrackEvent metrics dict, TrackPageView, etc.)
183
+ 10. Set `<ConnectionString>` in applicationinsights.config
184
+ 11. Build and verify
185
+
186
+ ## See also
187
+
188
+ - ApplicationInsightsWeb API reference(see in ApplicationInsightsWeb.md)
189
+ - ConfigureOpenTelemetryBuilder(see in TelemetryConfigurationBuilder.md)
190
+ - TelemetryClient breaking changes(see in TelemetryClient.md)
@@ -0,0 +1,106 @@
1
+ ---
2
+ title: Console App Application Insights 2.x to 3.x Migration
3
+ category: migration
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # Console App — AI SDK 2.x → 3.x Migration
8
+
9
+ ## What changed
10
+
11
+ Console apps use `TelemetryConfiguration` directly (non-DI). In 3.x, the core SDK is rebuilt on OpenTelemetry internally. Several APIs on `TelemetryConfiguration` and `TelemetryClient` are removed or changed.
12
+
13
+ Key changes:
14
+ - `TelemetryConfiguration.Active` — **Removed**. Use `TelemetryConfiguration.CreateDefault()`. Returns a static singleton in 3.x.
15
+ - `config.InstrumentationKey` — **Removed**. Use `config.ConnectionString` (required — throws if not set).
16
+ - `config.TelemetryInitializers` collection — **Removed**. Use `config.ConfigureOpenTelemetryBuilder(b => b.WithTracing(t => t.AddProcessor<T>()))`.
17
+ - `config.TelemetryProcessors` / `TelemetryProcessorChainBuilder` — **Removed**. Use OpenTelemetry processors.
18
+ - `config.TelemetryChannel` / `TelemetrySinks` — **Removed**. Export pipeline managed by OpenTelemetry internally.
19
+ - `DependencyTrackingTelemetryModule` manual init — **No longer needed**. Dependency tracking is automatic in 3.x.
20
+ - `new TelemetryClient()` (parameterless) — **Removed**. Use `new TelemetryClient(config)`.
21
+ - `SetAzureTokenCredential(object)` — Signature changed to `SetAzureTokenCredential(TokenCredential)` (strongly typed).
22
+
23
+ ## Before / after
24
+
25
+ **2.x**
26
+ ```csharp
27
+ using Microsoft.ApplicationInsights;
28
+ using Microsoft.ApplicationInsights.DependencyCollector;
29
+ using Microsoft.ApplicationInsights.Extensibility;
30
+
31
+ var config = TelemetryConfiguration.Active; // or CreateDefault()
32
+ config.InstrumentationKey = "your-ikey";
33
+ config.TelemetryInitializers.Add(new MyInitializer());
34
+
35
+ var dtModule = new DependencyTrackingTelemetryModule();
36
+ dtModule.Initialize(config);
37
+
38
+ var client = new TelemetryClient(config);
39
+ client.TrackEvent("Started");
40
+ // ...
41
+ client.Flush();
42
+ ```
43
+
44
+ **3.x**
45
+ ```csharp
46
+ using Microsoft.ApplicationInsights;
47
+ using Microsoft.ApplicationInsights.Extensibility;
48
+ using OpenTelemetry;
49
+
50
+ var config = TelemetryConfiguration.CreateDefault();
51
+ config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
52
+
53
+ // Extensibility via OpenTelemetry builder
54
+ config.ConfigureOpenTelemetryBuilder(builder =>
55
+ {
56
+ builder.WithTracing(tracing => tracing.AddProcessor<MyActivityProcessor>());
57
+ });
58
+
59
+ var client = new TelemetryClient(config);
60
+ client.TrackEvent("Started");
61
+ // ...
62
+ client.Flush();
63
+ ```
64
+
65
+ ## Removed APIs
66
+
67
+ | API | Status | Replacement |
68
+ |---|---|---|
69
+ | `TelemetryConfiguration.Active` | **Removed** | `TelemetryConfiguration.CreateDefault()` (static singleton) |
70
+ | `TelemetryConfiguration(string ikey)` | **Removed** | `CreateDefault()` + set `ConnectionString` |
71
+ | `config.InstrumentationKey` | **Removed** | `config.ConnectionString` |
72
+ | `config.TelemetryInitializers` | **Removed** | `config.ConfigureOpenTelemetryBuilder(...)` with `AddProcessor<T>()` |
73
+ | `config.TelemetryProcessors` | **Removed** | `config.ConfigureOpenTelemetryBuilder(...)` with `AddProcessor<T>()` |
74
+ | `config.TelemetryChannel` | **Removed** | Managed internally by OpenTelemetry |
75
+ | `config.TelemetrySinks` | **Removed** | Use OpenTelemetry exporters via `ConfigureOpenTelemetryBuilder` |
76
+ | `new TelemetryClient()` | **Removed** | `new TelemetryClient(config)` |
77
+ | `client.InstrumentationKey` | **Removed** | Use `config.ConnectionString` |
78
+ | `DependencyTrackingTelemetryModule` | **Not needed** | Dependency tracking is automatic |
79
+ | `OperationCorrelationTelemetryInitializer` | **Not needed** | Correlation is automatic via OpenTelemetry |
80
+ | `HttpDependenciesParsingTelemetryInitializer` | **Not needed** | Parsing is automatic |
81
+
82
+ ## New APIs
83
+
84
+ | API | Description |
85
+ |---|---|
86
+ | `config.ConnectionString` | Required. Set before creating `TelemetryClient`. |
87
+ | `config.ConfigureOpenTelemetryBuilder(Action<IOpenTelemetryBuilder>)` | Hook for adding processors, exporters, instrumentation. **Requires `using OpenTelemetry;`** — the `WithTracing()`, `WithLogging()`, `WithMetrics()`, and `ConfigureResource()` extension methods are in the root `OpenTelemetry` namespace. |
88
+ | `config.SetAzureTokenCredential(TokenCredential)` | AAD auth (strongly typed — was `object` in 2.x) |
89
+ | `config.SamplingRatio` | Fixed-rate sampling (0.0–1.0) |
90
+ | `config.TracesPerSecond` | Rate-limited sampling |
91
+
92
+ ## Migration steps
93
+
94
+ 1. Replace `TelemetryConfiguration.Active` with `TelemetryConfiguration.CreateDefault()`
95
+ 2. Replace `config.InstrumentationKey = "..."` with `config.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=..."`
96
+ 3. Remove manual `DependencyTrackingTelemetryModule` initialization — dependency tracking is automatic
97
+ 4. Remove `OperationCorrelationTelemetryInitializer` and `HttpDependenciesParsingTelemetryInitializer` — correlation and parsing are automatic
98
+ 5. Migrate custom `ITelemetryInitializer` implementations to `BaseProcessor<Activity>` — register via `config.ConfigureOpenTelemetryBuilder(b => b.WithTracing(t => t.AddProcessor<T>()))`
99
+ 6. Update `SetAzureTokenCredential((object)cred)` to `SetAzureTokenCredential(cred)` (remove cast — parameter is now `TokenCredential`)
100
+ 7. Update the NuGet package: `Microsoft.ApplicationInsights` to `3.*`, remove `Microsoft.ApplicationInsights.DependencyCollector`
101
+
102
+ ## See also
103
+
104
+ - [TelemetryConfigurationBuilder API reference](learn://api-reference/dotnet/TelemetryConfigurationBuilder.md)
105
+ - [TelemetryClient API reference](learn://api-reference/dotnet/TelemetryClient.md)
106
+ - [AAD Authentication Migration](learn://migration/dotnet/aad-authentication-migration.md)
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: ILogger and Log Filtering Migration (2.x to 3.x)
3
+ category: migration
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # ILogger and Log Filtering Migration (2.x → 3.x)
8
+
9
+ ## What changed
10
+
11
+ In 2.x, `AddApplicationInsightsTelemetry()` already captured ILogger output automatically. However, some codebases also called `AddApplicationInsights()` on `ILoggingBuilder` explicitly — for example, to configure `ApplicationInsightsLoggerOptions` or to add category-level log filters targeting `ApplicationInsightsLoggerProvider`.
12
+
13
+ In 3.x, ILogger capture remains automatic. The difference is that the underlying provider is now `OpenTelemetryLoggerProvider` (from the OpenTelemetry SDK). Any explicit `AddApplicationInsights()` calls and filters targeting `ApplicationInsightsLoggerProvider` must be updated.
14
+
15
+ | Aspect | 2.x | 3.x |
16
+ |---|---|---|
17
+ | Logger provider | `ApplicationInsightsLoggerProvider` (explicit) | `OpenTelemetryLoggerProvider` (automatic) |
18
+ | Registration | `loggingBuilder.AddApplicationInsights()` | Not needed — automatic |
19
+ | Category filters | `AddFilter<ApplicationInsightsLoggerProvider>(...)` | `AddFilter<OpenTelemetryLoggerProvider>(...)` or plain `AddFilter(...)` |
20
+ | Advanced filtering | `ITelemetryProcessor` | `BaseProcessor<LogRecord>` via `ConfigureOpenTelemetryLoggerProvider` |
21
+
22
+ ## Before / after
23
+
24
+ **2.x**
25
+ ```csharp
26
+ using Microsoft.Extensions.Logging.ApplicationInsights;
27
+
28
+ builder.Services.AddLogging(loggingBuilder =>
29
+ {
30
+ loggingBuilder.AddApplicationInsights(options =>
31
+ {
32
+ options.TrackExceptionsAsExceptionTelemetry = true;
33
+ options.IncludeScopes = true;
34
+ });
35
+ loggingBuilder.AddFilter<ApplicationInsightsLoggerProvider>("Microsoft.AspNetCore", LogLevel.Warning);
36
+ loggingBuilder.AddFilter<ApplicationInsightsLoggerProvider>("MyApp", LogLevel.Information);
37
+ });
38
+ ```
39
+
40
+ **3.x**
41
+ ```csharp
42
+ using OpenTelemetry.Logs; // Required for OpenTelemetryLoggerProvider
43
+
44
+ // Logging is automatic — just configure filters targeting the OTel provider
45
+ builder.Logging.AddFilter<OpenTelemetryLoggerProvider>("Microsoft.AspNetCore", LogLevel.Warning);
46
+ builder.Logging.AddFilter<OpenTelemetryLoggerProvider>("MyApp", LogLevel.Information);
47
+ ```
48
+
49
+ ## Migration steps
50
+
51
+ 1. **Remove `AddApplicationInsights()`** — delete the call and its options lambda (`TrackExceptionsAsExceptionTelemetry`, `IncludeScopes` no longer exist).
52
+ 2. **Replace log filters** — change `AddFilter<ApplicationInsightsLoggerProvider>` to `AddFilter<OpenTelemetryLoggerProvider>`, or use a plain `AddFilter(category, level)`. Add `using OpenTelemetry.Logs;` if targeting the provider specifically.
53
+ 3. **Update usings** — remove `using Microsoft.Extensions.Logging.ApplicationInsights;`.
54
+ 4. **Remove the package** — `Microsoft.Extensions.Logging.ApplicationInsights` is no longer needed.
@@ -0,0 +1,126 @@
1
+ ---
2
+ title: WorkerService 2.x to 3.x Code Migration
3
+ category: migration
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # Worker Service 2.x → 3.x Code Migration
8
+
9
+ ## What changed
10
+
11
+ 3.x uses OpenTelemetry under the hood. The main entry point is the same — `AddApplicationInsightsTelemetryWorkerService()` — but several options and an extension method were removed.
12
+
13
+ Key changes:
14
+ - `InstrumentationKey` → use `ConnectionString`
15
+ - `EnableAdaptiveSampling` → use `TracesPerSecond` (default `5`) or `SamplingRatio`
16
+ - Logging is automatic — no additional logger provider needed
17
+ - New: `Credential` for AAD authentication, `EnableTraceBasedLogsSampler` for log sampling control
18
+
19
+ ## Before / after
20
+
21
+ **2.x**
22
+ ```csharp
23
+ using Microsoft.Extensions.DependencyInjection;
24
+
25
+ builder.ConfigureServices(services =>
26
+ {
27
+ services.AddApplicationInsightsTelemetryWorkerService(options =>
28
+ {
29
+ options.InstrumentationKey = "your-ikey"; // Removed in 3.x
30
+ options.EnableAdaptiveSampling = false; // Removed in 3.x
31
+ options.DeveloperMode = true; // Removed in 3.x
32
+ });
33
+ });
34
+ ```
35
+
36
+ **3.x**
37
+ ```csharp
38
+ using Microsoft.Extensions.DependencyInjection;
39
+ using Microsoft.ApplicationInsights.WorkerService;
40
+
41
+ builder.ConfigureServices(services =>
42
+ {
43
+ services.AddApplicationInsightsTelemetryWorkerService(options =>
44
+ {
45
+ options.ConnectionString = "InstrumentationKey=...;IngestionEndpoint=...";
46
+ options.SamplingRatio = 1.0f; // No sampling (collect everything)
47
+ // DeveloperMode — no replacement needed, remove the line
48
+ });
49
+ });
50
+ ```
51
+
52
+ Or set `APPLICATIONINSIGHTS_CONNECTION_STRING` as an environment variable and call `AddApplicationInsightsTelemetryWorkerService()` with no arguments.
53
+
54
+ ## Property changes
55
+
56
+ | Property | Status | Action required |
57
+ |---|---|---|
58
+ | `ConnectionString` | Unchanged | None. |
59
+ | `ApplicationVersion` | Unchanged | None. |
60
+ | `EnableQuickPulseMetricStream` | Unchanged | None. Default `true`. |
61
+ | `EnablePerformanceCounterCollectionModule` | Unchanged | None. Default `true`. |
62
+ | `EnableDependencyTrackingTelemetryModule` | Unchanged | None. Default `true`. |
63
+ | `AddAutoCollectedMetricExtractor` | Unchanged | None. Default `true`. |
64
+ | `InstrumentationKey` | **Removed** | Use `ConnectionString`. |
65
+ | `EnableAdaptiveSampling` | **Removed** | Use `TracesPerSecond` or `SamplingRatio`. |
66
+ | `DeveloperMode` | **Removed** | Delete the line. |
67
+ | `EndpointAddress` | **Removed** | Endpoint is now part of `ConnectionString`. |
68
+ | `EnableHeartbeat` | **Removed** | Delete the line. |
69
+ | `EnableDebugLogger` | **Removed** | Delete the line. |
70
+ | `DependencyCollectionOptions` | **Removed** | Delete the line. |
71
+ | `EnableEventCounterCollectionModule` | **Removed** | Delete the line. |
72
+ | `EnableAppServicesHeartbeatTelemetryModule` | **Removed** | Delete the line; heartbeat is automatic. |
73
+ | `EnableAzureInstanceMetadataTelemetryModule` | **Removed** | Delete the line; resource detection is automatic. |
74
+ | `EnableDiagnosticsTelemetryModule` | **Removed** | Delete the line. |
75
+ | `Credential` | **New** | `TokenCredential`, default `null`. Set for AAD auth. |
76
+ | `TracesPerSecond` | **New** | `double?`, effective default `5`. Rate-limited sampling. |
77
+ | `SamplingRatio` | **New** | `float?`, default `null`. Fixed-rate sampling (0.0–1.0). |
78
+ | `EnableTraceBasedLogsSampler` | **New** | `bool?`, effective default `true`. Logs follow parent trace sampling. |
79
+
80
+ ## Removed extension methods
81
+
82
+ | Method | Replacement |
83
+ |---|---|
84
+ | `AddApplicationInsightsTelemetryWorkerService(string instrumentationKey)` | Use parameterless overload + `ConnectionString` in options or env var. |
85
+
86
+ ## TelemetryClient changes
87
+
88
+ | Change | Details |
89
+ |---|---|
90
+ | `TrackEvent` | 3-param overload `(string, IDictionary<string,string>, IDictionary<string,double>)` **removed** — metrics dict dropped. Use 2-param overload and track metrics separately via `TrackMetric()`. |
91
+ | `TrackException` | 3-param overload with `IDictionary<string,double>` **removed**. Use 2-param overload and track metrics separately via `TrackMetric()`. |
92
+ | `TrackAvailability` | 8-param overload with trailing `IDictionary<string,double>` **removed**. Use 7-param overload and track metrics separately via `TrackMetric()`. |
93
+ | `TrackPageView` | **Removed entirely** (both overloads). Use `TrackEvent` or `TrackRequest` instead. |
94
+ | `GetMetric` | `MetricConfiguration` and `MetricAggregationScope` params **removed** from all overloads. Use simplified `GetMetric(metricId, ...)`. |
95
+ | parameterless `TelemetryClient()` | **Removed**. Use `TelemetryClient(TelemetryConfiguration)` via DI. |
96
+ | `client.InstrumentationKey` | **Removed**. Use `TelemetryConfiguration.ConnectionString`. |
97
+ | `TrackTrace`, `TrackMetric`, `TrackRequest`, `TrackDependency` (full overload), `Flush` | **Unchanged** — no action needed. |
98
+
99
+ ## Migration steps
100
+
101
+ 1. Update the package:
102
+ ```xml
103
+ <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="3.*" />
104
+ ```
105
+
106
+ 2. Find and replace in your code:
107
+ - `InstrumentationKey = "..."` → `ConnectionString = "InstrumentationKey=...;IngestionEndpoint=..."`
108
+ - `EnableAdaptiveSampling = false` → `SamplingRatio = 1.0f` (or set `TracesPerSecond`)
109
+ - Delete any lines setting `DeveloperMode`, `EndpointAddress`, `EnableHeartbeat`, `EnableDebugLogger`, `DependencyCollectionOptions`, `EnableEventCounterCollectionModule`, `EnableAppServicesHeartbeatTelemetryModule`, `EnableAzureInstanceMetadataTelemetryModule`, or `EnableDiagnosticsTelemetryModule`
110
+ - Replace `AddApplicationInsightsTelemetryWorkerService("your-ikey")` with `AddApplicationInsightsTelemetryWorkerService()` and set `ConnectionString` via options or env var
111
+
112
+ 3. Migrate TelemetryClient breaking calls:
113
+ - Remove `IDictionary<string, double> metrics` parameter from `TrackEvent`/`TrackException`/`TrackAvailability` calls (track metrics separately via `TrackMetric()`). Replace `TrackPageView` with `TrackEvent` or `TrackRequest`. Remove `GetMetric` overloads that take `MetricConfiguration`/`MetricAggregationScope`.
114
+
115
+ 4. Build and verify — the `Enable*` flags (`EnableQuickPulseMetricStream`, `EnableDependencyTrackingTelemetryModule`, etc.) still work with the same defaults. No changes needed for those.
116
+
117
+ ## Behavior notes
118
+
119
+ - `TracesPerSecond` is the default sampling mode (effective default `5`). No configuration needed for most apps.
120
+ - Connection string resolution order: `ApplicationInsightsServiceOptions.ConnectionString` → `APPLICATIONINSIGHTS_CONNECTION_STRING` env var → `ApplicationInsights:ConnectionString` in config.
121
+
122
+ ## See also
123
+
124
+ - No-code-change migration(see in workerservice-2x-to-3x-no-code-change.md)
125
+ - AddApplicationInsightsTelemetryWorkerService API reference(see in AddApplicationInsightsTelemetryWorkerService.md)
126
+ - TelemetryClient breaking changes(see in TelemetryClient.md)