@azure/mcp-linux-arm64 2.0.0-beta.9 → 2.0.0

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 (68) hide show
  1. package/NOTICE.txt +5683 -4849
  2. package/README.md +148 -27
  3. package/dist/Azure.Mcp.Tools.AzureMigrate.xml +1060 -0
  4. package/dist/Instrumentation/Resources/api-reference/dotnet/ActivityProcessors.md +119 -0
  5. package/dist/Instrumentation/Resources/api-reference/dotnet/AddApplicationInsightsTelemetry.md +129 -0
  6. package/dist/Instrumentation/Resources/api-reference/dotnet/AddApplicationInsightsTelemetryWorkerService.md +115 -0
  7. package/dist/Instrumentation/Resources/api-reference/dotnet/AddOpenTelemetry.md +153 -0
  8. package/dist/Instrumentation/Resources/api-reference/dotnet/ApplicationInsightsWeb.md +103 -0
  9. package/dist/Instrumentation/Resources/api-reference/dotnet/AzureMonitorExporter.md +137 -0
  10. package/dist/Instrumentation/Resources/api-reference/dotnet/ConfigureOpenTelemetryProvider.md +218 -0
  11. package/dist/Instrumentation/Resources/api-reference/dotnet/ConfigureResource.md +119 -0
  12. package/dist/Instrumentation/Resources/api-reference/dotnet/ConsoleExporter.md +47 -0
  13. package/dist/Instrumentation/Resources/api-reference/dotnet/EntityFrameworkInstrumentation.md +56 -0
  14. package/dist/Instrumentation/Resources/api-reference/dotnet/HttpInstrumentation.md +109 -0
  15. package/dist/Instrumentation/Resources/api-reference/dotnet/LogProcessors.md +101 -0
  16. package/dist/Instrumentation/Resources/api-reference/dotnet/OpenTelemetrySdkCreate.md +146 -0
  17. package/dist/Instrumentation/Resources/api-reference/dotnet/OtlpExporter.md +88 -0
  18. package/dist/Instrumentation/Resources/api-reference/dotnet/RedisInstrumentation.md +63 -0
  19. package/dist/Instrumentation/Resources/api-reference/dotnet/Sampling.md +86 -0
  20. package/dist/Instrumentation/Resources/api-reference/dotnet/SdkCreateTracerProviderBuilder.md +127 -0
  21. package/dist/Instrumentation/Resources/api-reference/dotnet/SqlClientInstrumentation.md +53 -0
  22. package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryClient.md +122 -0
  23. package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryConfigurationBuilder.md +173 -0
  24. package/dist/Instrumentation/Resources/api-reference/dotnet/UseAzureMonitor.md +96 -0
  25. package/dist/Instrumentation/Resources/api-reference/dotnet/UseAzureMonitorExporter.md +146 -0
  26. package/dist/Instrumentation/Resources/api-reference/dotnet/WithLogging.md +109 -0
  27. package/dist/Instrumentation/Resources/api-reference/dotnet/WithMetrics.md +105 -0
  28. package/dist/Instrumentation/Resources/api-reference/dotnet/WithTracing.md +91 -0
  29. package/dist/Instrumentation/Resources/concepts/dotnet/appinsights-aspnetcore.md +113 -0
  30. package/dist/Instrumentation/Resources/concepts/dotnet/aspnet-classic-appinsights.md +95 -0
  31. package/dist/Instrumentation/Resources/concepts/dotnet/azure-monitor-distro.md +102 -0
  32. package/dist/Instrumentation/Resources/concepts/dotnet/opentelemetry-pipeline.md +57 -0
  33. package/dist/Instrumentation/Resources/concepts/nodejs/azure-monitor-overview.md +106 -0
  34. package/dist/Instrumentation/Resources/concepts/nodejs/opentelemetry-pipeline.md +201 -0
  35. package/dist/Instrumentation/Resources/concepts/python/azure-monitor-overview.md +122 -0
  36. package/dist/Instrumentation/Resources/concepts/python/opentelemetry-pipeline.md +154 -0
  37. package/dist/Instrumentation/Resources/examples/dotnet/aspnet-classic-setup.md +80 -0
  38. package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-distro-setup.md +156 -0
  39. package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-setup.md +160 -0
  40. package/dist/Instrumentation/Resources/examples/dotnet/workerservice-setup.md +154 -0
  41. package/dist/Instrumentation/Resources/examples/nodejs/bunyan-setup.md +301 -0
  42. package/dist/Instrumentation/Resources/examples/nodejs/console-setup.md +284 -0
  43. package/dist/Instrumentation/Resources/examples/nodejs/express-setup.md +169 -0
  44. package/dist/Instrumentation/Resources/examples/nodejs/fastify-setup.md +237 -0
  45. package/dist/Instrumentation/Resources/examples/nodejs/langchain-js-setup.md +310 -0
  46. package/dist/Instrumentation/Resources/examples/nodejs/mongodb-setup.md +185 -0
  47. package/dist/Instrumentation/Resources/examples/nodejs/mysql-setup.md +231 -0
  48. package/dist/Instrumentation/Resources/examples/nodejs/nestjs-setup.md +184 -0
  49. package/dist/Instrumentation/Resources/examples/nodejs/nextjs-setup.md +320 -0
  50. package/dist/Instrumentation/Resources/examples/nodejs/postgres-setup.md +147 -0
  51. package/dist/Instrumentation/Resources/examples/nodejs/redis-setup.md +198 -0
  52. package/dist/Instrumentation/Resources/examples/nodejs/winston-setup.md +260 -0
  53. package/dist/Instrumentation/Resources/examples/python/console-setup.md +392 -0
  54. package/dist/Instrumentation/Resources/examples/python/django-setup.md +269 -0
  55. package/dist/Instrumentation/Resources/examples/python/fastapi-setup.md +256 -0
  56. package/dist/Instrumentation/Resources/examples/python/flask-setup.md +218 -0
  57. package/dist/Instrumentation/Resources/examples/python/genai-setup.md +214 -0
  58. package/dist/Instrumentation/Resources/examples/python/generic-setup.md +164 -0
  59. package/dist/Instrumentation/Resources/migration/dotnet/aad-authentication-migration.md +150 -0
  60. package/dist/Instrumentation/Resources/migration/dotnet/appinsights-2x-to-3x-code-migration.md +164 -0
  61. package/dist/Instrumentation/Resources/migration/dotnet/appinsights-2x-to-3x-no-code-change.md +92 -0
  62. package/dist/Instrumentation/Resources/migration/dotnet/aspnet-classic-2x-to-3x-code-migration.md +190 -0
  63. package/dist/Instrumentation/Resources/migration/dotnet/console-2x-to-3x-code-migration.md +106 -0
  64. package/dist/Instrumentation/Resources/migration/dotnet/ilogger-migration.md +54 -0
  65. package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-code-migration.md +126 -0
  66. package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-no-code-change.md +102 -0
  67. package/dist/azmcp +0 -0
  68. package/package.json +1 -1
@@ -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)
@@ -0,0 +1,160 @@
1
+ ---
2
+ title: ASP.NET Core Setup with Application Insights
3
+ category: example
4
+ applies-to: 3.x
5
+ ---
6
+
7
+ # ASP.NET Core Setup with Application Insights
8
+
9
+ **Category:** Example
10
+ **Applies to:** 3.x
11
+
12
+ ## Overview
13
+
14
+ Complete working example of adding Application Insights to a new ASP.NET Core application using `Microsoft.ApplicationInsights.AspNetCore`.
15
+
16
+ ## Step 1: Add Package
17
+
18
+ ```bash
19
+ dotnet add package Microsoft.ApplicationInsights.AspNetCore
20
+ ```
21
+
22
+ Or in `.csproj`:
23
+
24
+ ```xml
25
+ <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="3.*" />
26
+ ```
27
+
28
+ ## Step 2: Configure in Program.cs
29
+
30
+ ### Minimal Setup
31
+
32
+ ```csharp
33
+ var builder = WebApplication.CreateBuilder(args);
34
+
35
+ // Add Application Insights - one line!
36
+ builder.Services.AddApplicationInsightsTelemetry();
37
+
38
+ builder.Services.AddControllers();
39
+
40
+ var app = builder.Build();
41
+
42
+ app.MapControllers();
43
+ app.Run();
44
+ ```
45
+
46
+ ### With Configuration Options
47
+
48
+ ```csharp
49
+ using Microsoft.ApplicationInsights.AspNetCore.Extensions;
50
+
51
+ var builder = WebApplication.CreateBuilder(args);
52
+
53
+ builder.Services.AddApplicationInsightsTelemetry(options =>
54
+ {
55
+ options.ConnectionString = builder.Configuration["ApplicationInsights:ConnectionString"];
56
+ options.EnableQuickPulseMetricStream = true;
57
+ options.SamplingRatio = 0.5f; // Collect 50% of telemetry
58
+ });
59
+
60
+ builder.Services.AddControllers();
61
+
62
+ var app = builder.Build();
63
+
64
+ app.MapControllers();
65
+ app.Run();
66
+ ```
67
+
68
+ ## Step 3: Configure Connection String
69
+
70
+ ### Option A: Environment Variable (Recommended for Production)
71
+
72
+ ```bash
73
+ export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=xxx;IngestionEndpoint=https://..."
74
+ ```
75
+
76
+ ### Option B: appsettings.json
77
+
78
+ ```json
79
+ {
80
+ "ApplicationInsights": {
81
+ "ConnectionString": "InstrumentationKey=xxx;IngestionEndpoint=https://..."
82
+ }
83
+ }
84
+ ```
85
+
86
+ ### Option C: User Secrets (Development)
87
+
88
+ ```bash
89
+ dotnet user-secrets set "ApplicationInsights:ConnectionString" "InstrumentationKey=xxx;..."
90
+ ```
91
+
92
+ ## Complete Program.cs
93
+
94
+ ```csharp
95
+ var builder = WebApplication.CreateBuilder(args);
96
+
97
+ // Add services
98
+ builder.Services.AddControllers();
99
+ builder.Services.AddEndpointsApiExplorer();
100
+ builder.Services.AddSwaggerGen();
101
+
102
+ // Add Application Insights telemetry
103
+ builder.Services.AddApplicationInsightsTelemetry();
104
+
105
+ var app = builder.Build();
106
+
107
+ // Configure pipeline
108
+ if (app.Environment.IsDevelopment())
109
+ {
110
+ app.UseSwagger();
111
+ app.UseSwaggerUI();
112
+ }
113
+
114
+ app.UseHttpsRedirection();
115
+ app.UseAuthorization();
116
+ app.MapControllers();
117
+
118
+ app.Run();
119
+ ```
120
+
121
+ ## What You Get Automatically
122
+
123
+ After this setup, Application Insights will collect:
124
+
125
+ | Signal | Data |
126
+ |--------|------|
127
+ | **Requests** | All incoming HTTP requests with timing, status codes |
128
+ | **Dependencies** | Outgoing HTTP calls, SQL queries, Azure SDK calls |
129
+ | **Exceptions** | Unhandled exceptions with stack traces |
130
+ | **Logs** | ILogger output (Information level and above) |
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
+ ```
145
+
146
+ ## Verify It Works
147
+
148
+ 1. Run your application
149
+ 2. Make some requests
150
+ 3. Check Application Insights in Azure Portal (may take 2-5 minutes)
151
+ 4. Look for:
152
+ - Live Metrics (immediate)
153
+ - Transaction Search (requests, dependencies)
154
+ - Failures (exceptions)
155
+
156
+ ## See Also
157
+
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