@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,156 @@
1
+ ---
2
+ title: Basic ASP.NET Core Setup
3
+ category: example
4
+ applies-to: 3.x
5
+ source: ApplicationInsightsDemo/Program.cs
6
+ ---
7
+
8
+ # Basic ASP.NET Core Setup
9
+
10
+ **Category:** Example
11
+ **Applies to:** 3.x
12
+
13
+ ## Overview
14
+
15
+ Complete working example of adding Azure Monitor to a new ASP.NET Core application.
16
+
17
+ ## Step 1: Add Package
18
+
19
+ ```bash
20
+ dotnet add package Azure.Monitor.OpenTelemetry.AspNetCore
21
+ ```
22
+
23
+ Or in `.csproj`:
24
+
25
+ ```xml
26
+ <PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.3.0" />
27
+ ```
28
+
29
+ ## Step 2: Configure in Program.cs
30
+
31
+ ### Minimal Setup
32
+
33
+ ```csharp
34
+ using Azure.Monitor.OpenTelemetry.AspNetCore;
35
+
36
+ var builder = WebApplication.CreateBuilder(args);
37
+
38
+ // Add Azure Monitor - one line!
39
+ builder.Services.AddOpenTelemetry().UseAzureMonitor();
40
+
41
+ builder.Services.AddControllers();
42
+
43
+ var app = builder.Build();
44
+
45
+ app.MapControllers();
46
+ app.Run();
47
+ ```
48
+
49
+ ### With Configuration Options
50
+
51
+ ```csharp
52
+ using Azure.Monitor.OpenTelemetry.AspNetCore;
53
+
54
+ var builder = WebApplication.CreateBuilder(args);
55
+
56
+ builder.Services.AddOpenTelemetry().UseAzureMonitor(options =>
57
+ {
58
+ // Connection string from configuration
59
+ options.ConnectionString = builder.Configuration["AzureMonitor:ConnectionString"];
60
+
61
+ // Sample 50% of requests in production
62
+ if (!builder.Environment.IsDevelopment())
63
+ {
64
+ options.SamplingRatio = 0.5f;
65
+ }
66
+ });
67
+
68
+ builder.Services.AddControllers();
69
+
70
+ var app = builder.Build();
71
+
72
+ app.MapControllers();
73
+ app.Run();
74
+ ```
75
+
76
+ ## Step 3: Configure Connection String
77
+
78
+ ### Option A: Environment Variable (Recommended for Production)
79
+
80
+ ```bash
81
+ export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=xxx;IngestionEndpoint=https://..."
82
+ ```
83
+
84
+ ### Option B: appsettings.json
85
+
86
+ ```json
87
+ {
88
+ "AzureMonitor": {
89
+ "ConnectionString": "InstrumentationKey=xxx;IngestionEndpoint=https://..."
90
+ }
91
+ }
92
+ ```
93
+
94
+ ### Option C: User Secrets (Development)
95
+
96
+ ```bash
97
+ dotnet user-secrets set "AzureMonitor:ConnectionString" "InstrumentationKey=xxx;..."
98
+ ```
99
+
100
+ ## Complete Program.cs
101
+
102
+ ```csharp
103
+ using Azure.Monitor.OpenTelemetry.AspNetCore;
104
+
105
+ var builder = WebApplication.CreateBuilder(args);
106
+
107
+ // Add services
108
+ builder.Services.AddControllers();
109
+ builder.Services.AddEndpointsApiExplorer();
110
+ builder.Services.AddSwaggerGen();
111
+
112
+ // Add Azure Monitor OpenTelemetry
113
+ builder.Services.AddOpenTelemetry().UseAzureMonitor();
114
+
115
+ var app = builder.Build();
116
+
117
+ // Configure pipeline
118
+ if (app.Environment.IsDevelopment())
119
+ {
120
+ app.UseSwagger();
121
+ app.UseSwaggerUI();
122
+ }
123
+
124
+ app.UseHttpsRedirection();
125
+ app.UseAuthorization();
126
+ app.MapControllers();
127
+
128
+ app.Run();
129
+ ```
130
+
131
+ ## What You Get Automatically
132
+
133
+ After this setup, Azure Monitor will collect:
134
+
135
+ | Signal | Data |
136
+ |--------|------|
137
+ | **Requests** | All incoming HTTP requests with timing, status codes |
138
+ | **Dependencies** | Outgoing HTTP calls, SQL queries, Azure SDK calls |
139
+ | **Exceptions** | Unhandled exceptions with stack traces |
140
+ | **Logs** | ILogger output (Information level and above) |
141
+ | **Metrics** | Request rate, response time, CPU, memory |
142
+
143
+ ## Verify It Works
144
+
145
+ 1. Run your application
146
+ 2. Make some requests
147
+ 3. Check Application Insights in Azure Portal (may take 2-5 minutes)
148
+ 4. Look for:
149
+ - Live Metrics (immediate)
150
+ - Transaction Search (requests, dependencies)
151
+ - Failures (exceptions)
152
+
153
+ ## See Also
154
+
155
+ - Azure Monitor Distro(see in azure-monitor-distro.md)
156
+ - UseAzureMonitor API(see in UseAzureMonitor.md)
@@ -1,29 +1,28 @@
1
1
  ---
2
- title: Basic ASP.NET Core Setup
2
+ title: ASP.NET Core Setup with Application Insights
3
3
  category: example
4
4
  applies-to: 3.x
5
- source: ApplicationInsightsDemo/Program.cs
6
5
  ---
7
6
 
8
- # Basic ASP.NET Core Setup
7
+ # ASP.NET Core Setup with Application Insights
9
8
 
10
- **Category:** Example
9
+ **Category:** Example
11
10
  **Applies to:** 3.x
12
11
 
13
12
  ## Overview
14
13
 
15
- Complete working example of adding Azure Monitor to a new ASP.NET Core application.
14
+ Complete working example of adding Application Insights to a new ASP.NET Core application using `Microsoft.ApplicationInsights.AspNetCore`.
16
15
 
17
16
  ## Step 1: Add Package
18
17
 
19
18
  ```bash
20
- dotnet add package Azure.Monitor.OpenTelemetry.AspNetCore
19
+ dotnet add package Microsoft.ApplicationInsights.AspNetCore
21
20
  ```
22
21
 
23
22
  Or in `.csproj`:
24
23
 
25
24
  ```xml
26
- <PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.3.0" />
25
+ <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="3.*" />
27
26
  ```
28
27
 
29
28
  ## Step 2: Configure in Program.cs
@@ -31,12 +30,10 @@ Or in `.csproj`:
31
30
  ### Minimal Setup
32
31
 
33
32
  ```csharp
34
- using Azure.Monitor.OpenTelemetry.AspNetCore;
35
-
36
33
  var builder = WebApplication.CreateBuilder(args);
37
34
 
38
- // Add Azure Monitor - one line!
39
- builder.Services.AddOpenTelemetry().UseAzureMonitor();
35
+ // Add Application Insights - one line!
36
+ builder.Services.AddApplicationInsightsTelemetry();
40
37
 
41
38
  builder.Services.AddControllers();
42
39
 
@@ -49,20 +46,15 @@ app.Run();
49
46
  ### With Configuration Options
50
47
 
51
48
  ```csharp
52
- using Azure.Monitor.OpenTelemetry.AspNetCore;
49
+ using Microsoft.ApplicationInsights.AspNetCore.Extensions;
53
50
 
54
51
  var builder = WebApplication.CreateBuilder(args);
55
52
 
56
- builder.Services.AddOpenTelemetry().UseAzureMonitor(options =>
53
+ builder.Services.AddApplicationInsightsTelemetry(options =>
57
54
  {
58
- // Connection string from configuration
59
- options.ConnectionString = builder.Configuration["AzureMonitor:ConnectionString"];
60
-
61
- // Sample 50% of requests in production
62
- if (!builder.Environment.IsDevelopment())
63
- {
64
- options.SamplingRatio = 0.5f;
65
- }
55
+ options.ConnectionString = builder.Configuration["ApplicationInsights:ConnectionString"];
56
+ options.EnableQuickPulseMetricStream = true;
57
+ options.SamplingRatio = 0.5f; // Collect 50% of telemetry
66
58
  });
67
59
 
68
60
  builder.Services.AddControllers();
@@ -85,7 +77,7 @@ export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=xxx;IngestionEn
85
77
 
86
78
  ```json
87
79
  {
88
- "AzureMonitor": {
80
+ "ApplicationInsights": {
89
81
  "ConnectionString": "InstrumentationKey=xxx;IngestionEndpoint=https://..."
90
82
  }
91
83
  }
@@ -94,14 +86,12 @@ export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=xxx;IngestionEn
94
86
  ### Option C: User Secrets (Development)
95
87
 
96
88
  ```bash
97
- dotnet user-secrets set "AzureMonitor:ConnectionString" "InstrumentationKey=xxx;..."
89
+ dotnet user-secrets set "ApplicationInsights:ConnectionString" "InstrumentationKey=xxx;..."
98
90
  ```
99
91
 
100
92
  ## Complete Program.cs
101
93
 
102
94
  ```csharp
103
- using Azure.Monitor.OpenTelemetry.AspNetCore;
104
-
105
95
  var builder = WebApplication.CreateBuilder(args);
106
96
 
107
97
  // Add services
@@ -109,8 +99,8 @@ builder.Services.AddControllers();
109
99
  builder.Services.AddEndpointsApiExplorer();
110
100
  builder.Services.AddSwaggerGen();
111
101
 
112
- // Add Azure Monitor OpenTelemetry
113
- builder.Services.AddOpenTelemetry().UseAzureMonitor();
102
+ // Add Application Insights telemetry
103
+ builder.Services.AddApplicationInsightsTelemetry();
114
104
 
115
105
  var app = builder.Build();
116
106
 
@@ -130,7 +120,7 @@ app.Run();
130
120
 
131
121
  ## What You Get Automatically
132
122
 
133
- After this setup, Azure Monitor will collect:
123
+ After this setup, Application Insights will collect:
134
124
 
135
125
  | Signal | Data |
136
126
  |--------|------|
@@ -139,6 +129,19 @@ After this setup, Azure Monitor will collect:
139
129
  | **Exceptions** | Unhandled exceptions with stack traces |
140
130
  | **Logs** | ILogger output (Information level and above) |
141
131
  | **Metrics** | Request rate, response time, CPU, memory |
132
+ | **Live Metrics** | Real-time monitoring via QuickPulse |
133
+ | **Performance Counters** | GC, thread pool, process metrics |
134
+
135
+ ## Extending with OpenTelemetry
136
+
137
+ Application Insights 3.x is built on OpenTelemetry. You can add custom sources and meters:
138
+
139
+ ```csharp
140
+ builder.Services.AddApplicationInsightsTelemetry();
141
+ builder.Services.AddOpenTelemetry()
142
+ .WithTracing(t => t.AddSource("MyApp.CustomSource"))
143
+ .WithMetrics(m => m.AddMeter("MyApp.CustomMeter"));
144
+ ```
142
145
 
143
146
  ## Verify It Works
144
147
 
@@ -152,5 +155,6 @@ After this setup, Azure Monitor will collect:
152
155
 
153
156
  ## See Also
154
157
 
155
- - Azure Monitor Distro(see in azure-monitor-distro.md)
156
- - UseAzureMonitor API(see in UseAzureMonitor.md)
158
+ - Application Insights for ASP.NET Core (see in appinsights-aspnetcore.md)
159
+ - AddApplicationInsightsTelemetry API (see in AddApplicationInsightsTelemetry.md)
160
+ - App Insights 2.x to 3.x Migration (see in appinsights-2x-to-3x-code-migration.md)
@@ -0,0 +1,154 @@
1
+ ---
2
+ title: Basic Worker Service Setup
3
+ category: example
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # Basic Worker Service Setup
8
+
9
+ **Category:** Example
10
+ **Applies to:** 3.x
11
+
12
+ ## Overview
13
+
14
+ Complete working example of adding Application Insights telemetry to a .NET Worker Service application using `Microsoft.ApplicationInsights.WorkerService`.
15
+
16
+ Worker Services are long-running background services that don't handle HTTP requests directly. Common examples include:
17
+ - Background job processors
18
+ - Message queue consumers
19
+ - Scheduled task runners
20
+ - Windows Services / Linux daemons
21
+
22
+ ## Step 1: Add Package
23
+
24
+ ```bash
25
+ dotnet add package Microsoft.ApplicationInsights.WorkerService --version 3.0.0-rc1
26
+ ```
27
+
28
+ Or in `.csproj`:
29
+
30
+ ```xml
31
+ <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="3.0.0-rc1" />
32
+ ```
33
+
34
+ ## Step 2: Configure in Program.cs
35
+
36
+ ### Using Host.CreateDefaultBuilder (Traditional Pattern)
37
+
38
+ ```csharp
39
+ using Microsoft.Extensions.DependencyInjection;
40
+ using Microsoft.Extensions.Hosting;
41
+
42
+ var host = Host.CreateDefaultBuilder(args)
43
+ .ConfigureServices((context, services) =>
44
+ {
45
+ // Add Application Insights telemetry
46
+ services.AddApplicationInsightsTelemetryWorkerService();
47
+
48
+ // Add your worker service
49
+ services.AddHostedService<Worker>();
50
+ })
51
+ .Build();
52
+
53
+ await host.RunAsync();
54
+ ```
55
+
56
+ ### Using Host.CreateApplicationBuilder (Modern Pattern)
57
+
58
+ ```csharp
59
+ using Microsoft.Extensions.DependencyInjection;
60
+ using Microsoft.Extensions.Hosting;
61
+
62
+ var builder = Host.CreateApplicationBuilder(args);
63
+
64
+ // Add Application Insights telemetry
65
+ builder.Services.AddApplicationInsightsTelemetryWorkerService();
66
+
67
+ // Add your worker service
68
+ builder.Services.AddHostedService<Worker>();
69
+
70
+ var host = builder.Build();
71
+ await host.RunAsync();
72
+ ```
73
+
74
+ ### With Configuration Options
75
+
76
+ ```csharp
77
+ services.AddApplicationInsightsTelemetryWorkerService(options =>
78
+ {
79
+ // Explicitly set connection string
80
+ options.ConnectionString = configuration["ApplicationInsights:ConnectionString"];
81
+
82
+ // Enable dependency tracking
83
+ options.EnableDependencyTrackingTelemetryModule = true;
84
+ });
85
+ ```
86
+
87
+ ## Step 3: Configure Connection String
88
+
89
+ ### Option A: Environment Variable (Recommended for Production)
90
+
91
+ ```bash
92
+ export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=xxx;IngestionEndpoint=https://..."
93
+ ```
94
+
95
+ ### Option B: appsettings.json
96
+
97
+ ```json
98
+ {
99
+ "ApplicationInsights": {
100
+ "ConnectionString": "InstrumentationKey=xxx;IngestionEndpoint=https://..."
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## What Gets Instrumented Automatically
106
+
107
+ The `AddApplicationInsightsTelemetryWorkerService()` method configures:
108
+
109
+ - **Dependency Tracking**: HTTP client calls, SQL queries, Azure SDK calls
110
+ - **Performance Counters**: CPU, memory, GC metrics
111
+ - **Exception Tracking**: Unhandled exceptions
112
+ - **Custom Telemetry**: Via `TelemetryClient` injection
113
+
114
+ ## Adding Custom Telemetry
115
+
116
+ Inject `TelemetryClient` into your worker:
117
+
118
+ ```csharp
119
+ public class Worker : BackgroundService
120
+ {
121
+ private readonly TelemetryClient _telemetryClient;
122
+ private readonly ILogger<Worker> _logger;
123
+
124
+ public Worker(TelemetryClient telemetryClient, ILogger<Worker> logger)
125
+ {
126
+ _telemetryClient = telemetryClient;
127
+ _logger = logger;
128
+ }
129
+
130
+ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
131
+ {
132
+ while (!stoppingToken.IsCancellationRequested)
133
+ {
134
+ // Track custom events
135
+ _telemetryClient.TrackEvent("WorkerIteration", new Dictionary<string, string>
136
+ {
137
+ ["timestamp"] = DateTime.UtcNow.ToString("O")
138
+ });
139
+
140
+ // Track custom metrics
141
+ _telemetryClient.TrackMetric("ItemsProcessed", processedCount);
142
+
143
+ await Task.Delay(1000, stoppingToken);
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ## Best Practices
150
+
151
+ 1. **Use structured logging**: ILogger integration sends logs to Application Insights automatically
152
+ 2. **Track operation context**: Use `TelemetryClient.StartOperation` for long-running operations
153
+ 3. **Flush on shutdown**: Call `TelemetryClient.Flush()` before application exits
154
+ 4. **Configure sampling**: For high-volume services, configure adaptive sampling to control costs