diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 386cc57..0279d33 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -1,14 +1,26 @@
{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
- "label": "build",
+ "label": "build QuickStart 3.1",
"command": "dotnet",
- "type": "process",
+ "type": "shell",
"args": [
"build",
- "${workspaceFolder}/examples/EnableServiceProfilerInVSCLR21/CLR21Example/CLR21Example/CLR21Example.csproj"
+ // Ask dotnet build to generate full paths for file names.
+ "/property:GenerateFullPaths=true",
+ // Do not generate summary otherwise it leads to duplicate errors in Problems panel
+ "/consoleloggerparameters:NoSummary"
],
+ "options": {
+ "cwd": "${workspaceFolder}/examples/QuickStart3_1/"
+ },
+ "group": "build",
+ "presentation": {
+ "reveal": "always"
+ },
"problemMatcher": "$msCompile"
}
]
diff --git a/Configurations.md b/Configurations.md
index 0be9e92..8802cee 100644
--- a/Configurations.md
+++ b/Configurations.md
@@ -75,7 +75,7 @@ To do that, in `appsettings.json`:
"Logging": {
"LogLevel": {
"Default": "Warning",
- "ServiceProfiler": "Debug"
+ "Microsoft.ApplicationInsights.Profiler": "Debug"
}
}
}
@@ -88,7 +88,7 @@ Here's a complete example of `appsettings.json`:
"Logging": {
"LogLevel": {
"Default": "Warning",
- "ServiceProfiler": "Debug"
+ "Microsoft.ApplicationInsights.Profiler": "Debug"
}
},
"AllowedHosts": "*",
diff --git a/README.md b/README.md
index 63dde99..4467418 100644
--- a/README.md
+++ b/README.md
@@ -2,12 +2,14 @@
## Announcement
+* It is official! We are out of beta! Profiler 2.2.0 is published. Find the NuGet package: [2.2.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0)
+
+## Previous announcements
+
* Profiler 2.2.0-beta7 is published. Find the NuGet package here: [2.2.0-beta7](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta7).
* Remove the logging from the Uplaoder by default. ([#128 Application is starting and shutting down messages written when using profiler](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/issues/128)).
* Some other small fixes.
-## Previous announcements
-
* Profiler 2.2.0-beta6 is published. Find the NuGet package here: [2.2.0-beta6](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta6).
* Fix the issue of Uploader not exit in the last release. Details: [#124](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/issues/124).
@@ -37,7 +39,7 @@ dotnet new webapi
```shell
dotnet add package Microsoft.ApplicationInsights.AspNetCore
-dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.2.0-*
+dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore
```
_Notice: .NET Core 2.2 is **out of support**, it is recommended to migrate your project to .NET 3.1. Refer to [.NET Core](https://dotnet.microsoft.com/download/dotnet-core) page for details. If you have to stay on .NET Core 2.2 for now, please this specific version of [`Microsoft.ApplicationInsights.AspNetCore v2.14`](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.14.0) alone with the profiler package._
@@ -68,7 +70,7 @@ To make it real, make use the following code to add some delay in the [WeatherFo
```csharp
using System.Threading;
...
-private void SimulateDelay()
+private static void SimulateDelay()
{
// Delay for 200ms to 5s to simulate a bottleneck.
Thread.Sleep((new Random()).Next(200, 5000));
@@ -102,6 +104,8 @@ In [appsettings.Development.json](examples/QuickStart3_0/appsettings.Development
}
```
+* Alternatively, use a connection string like in [QuickStart3.1 example](./examples/QuickStart3_1/appsettings.Development.json).
+
* Run the WebAPI, generate traffic for profiling
To run your application locally:
diff --git a/ReleaseNote.md b/ReleaseNote.md
index ee2788b..6b01a20 100644
--- a/ReleaseNote.md
+++ b/ReleaseNote.md
@@ -1,5 +1,10 @@
# Release Note
+## 2.2.0
+
+* Find the NuGet package: [2.2.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0).
+ * We are officially out of beta.
+
## 2.2.0-beta7
* Find the NuGet package here: [2.2.0-beta7](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta7).
diff --git a/SupportMatrix.md b/SupportMatrix.md
index aa6c2ee..54127e0 100644
--- a/SupportMatrix.md
+++ b/SupportMatrix.md
@@ -20,6 +20,7 @@ The profiling technology is based on .NET Core runtime. We do not support applic
| Application Insights Profiler | Windows (Experimental support) | Linux |
|-------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|-----------------------------|
+| [2.2.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0) | .NET Core App 3.1, .NET 5 | .NET Core App 3.1, .NET 5 |
| [2.2.0-beta7](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta7) | .NET Core App 3.1, .NET 5 | .NET Core App 3.1, .NET 5 |
| [2.2.0-beta6](https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta6) | .NET Core App 3.1, .NET 5 | .NET Core App 3.1, .NET 5 |
| 2.2.0-beta5 | .NET Core App 3.1, .NET 5 | .NET Core App 3.1, .NET 5 |
diff --git a/docs/MigrateTo2_0.md b/docs/MigrateTo2_0.md
index e9291b4..3e9521e 100644
--- a/docs/MigrateTo2_0.md
+++ b/docs/MigrateTo2_0.md
@@ -7,13 +7,13 @@ There are break changes between 1.x and 2.0 for Application Insights Profiler bu
* To use .NET Core CLI:
```shell
-dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore --version 2.2.0-*
+dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore --version 2.*
```
* To use package manager:
```shell
-Install-Package Microsoft.ApplicationInsights.Profiler.AspNetCore -Version 2.2.0-*
+Install-Package Microsoft.ApplicationInsights.Profiler.AspNetCore -Version 2.*
```
## Update the configurations
diff --git a/examples/EnableServiceProfilerForContainerApp/Dockerfile b/examples/EnableServiceProfilerForContainerApp/Dockerfile
index 318c1fa..47f5a3a 100644
--- a/examples/EnableServiceProfilerForContainerApp/Dockerfile
+++ b/examples/EnableServiceProfilerForContainerApp/Dockerfile
@@ -5,7 +5,7 @@ WORKDIR /app
COPY . ./
# Adding a reference to hosting startup package
-RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.2.0-*
+RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.*
# Restore & publish the app
RUN dotnet publish -c Release -o out
diff --git a/examples/HostingStartupCLR3/Dockerfile b/examples/HostingStartupCLR3/Dockerfile
index 9c5317b..4df82da 100644
--- a/examples/HostingStartupCLR3/Dockerfile
+++ b/examples/HostingStartupCLR3/Dockerfile
@@ -6,7 +6,7 @@ COPY . ./
# Add additional nuget packages
RUN dotnet add package Microsoft.ApplicationInsights.AspNetCore --no-restore
-RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.2.0-* --no-restore
+RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.* --no-restore
# Restore
RUN dotnet restore
diff --git a/examples/HostingStartupCLR3/Readme.md b/examples/HostingStartupCLR3/Readme.md
index 63b2251..b45def6 100644
--- a/examples/HostingStartupCLR3/Readme.md
+++ b/examples/HostingStartupCLR3/Readme.md
@@ -50,7 +50,7 @@ There are small tweaks needed to make it work.
# Add reference to the latest stable version of Application Insights for ASP.NET Core.
RUN dotnet add package Microsoft.ApplicationInsights.AspNetCore --no-restore
# Adding reference to Microsoft.ApplicationInsights.Profiler
-RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.2.0-* --no-restore
+RUN dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.* --no-restore
```
As you already know, invoking `dotnet add` does nothing but update the project file. And running `COPY . ./` next will overwrite the change. To deal with it, copy everything before adding packages and do not copy it again later.
diff --git a/examples/QuickStart3_0/QuickStart3_0.csproj b/examples/QuickStart3_0/QuickStart3_0.csproj
index ce67756..dfdc528 100644
--- a/examples/QuickStart3_0/QuickStart3_0.csproj
+++ b/examples/QuickStart3_0/QuickStart3_0.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/examples/QuickStart3_0/Readme.md b/examples/QuickStart3_0/Readme.md
index bc8226b..b16b44e 100644
--- a/examples/QuickStart3_0/Readme.md
+++ b/examples/QuickStart3_0/Readme.md
@@ -23,7 +23,7 @@ The latest Application Insights (2.8+) is required to run on .NET Core 3.0. And
```shell
dotnet add package Microsoft.ApplicationInsights.AspNetCore
-dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.2.0-*
+dotnet add package Microsoft.ApplicationInsights.Profiler.AspNetCore -v 2.*
```
### Update the code in `Startup.cs` to enable application insights and the profiler
diff --git a/examples/QuickStart3_1/Controllers/WeatherForecastController.cs b/examples/QuickStart3_1/Controllers/WeatherForecastController.cs
new file mode 100644
index 0000000..0136ca0
--- /dev/null
+++ b/examples/QuickStart3_1/Controllers/WeatherForecastController.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
+
+namespace QuickStart3_1.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class WeatherForecastController : ControllerBase
+ {
+ private static readonly string[] Summaries = new[]
+ {
+ "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+ };
+
+ private readonly ILogger _logger;
+
+ public WeatherForecastController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet]
+ public IEnumerable Get()
+ {
+ SimulateDelay();
+ var rng = new Random();
+ return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = DateTime.Now.AddDays(index),
+ TemperatureC = rng.Next(-20, 55),
+ Summary = Summaries[rng.Next(Summaries.Length)]
+ })
+ .ToArray();
+ }
+
+ private static void SimulateDelay()
+ {
+ // Delay for 500ms to 2s to simulate a bottleneck.
+ Thread.Sleep((new Random()).Next(500, 2000));
+ }
+ }
+}
diff --git a/examples/QuickStart3_1/Program.cs b/examples/QuickStart3_1/Program.cs
new file mode 100644
index 0000000..498a635
--- /dev/null
+++ b/examples/QuickStart3_1/Program.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+
+namespace QuickStart3_1
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ CreateHostBuilder(args).Build().Run();
+ }
+
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ });
+ }
+}
diff --git a/examples/QuickStart3_1/QuickStart3_1.csproj b/examples/QuickStart3_1/QuickStart3_1.csproj
new file mode 100644
index 0000000..98c7fb0
--- /dev/null
+++ b/examples/QuickStart3_1/QuickStart3_1.csproj
@@ -0,0 +1,13 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+
diff --git a/examples/QuickStart3_1/Readme.md b/examples/QuickStart3_1/Readme.md
new file mode 100644
index 0000000..c5c276d
--- /dev/null
+++ b/examples/QuickStart3_1/Readme.md
@@ -0,0 +1,53 @@
+# Quick Start (.NET Core 3.1 WebAPI)
+
+## Build the solution
+
+Refer to the same steps to build a [WebAPI for .NET 3.0](../QuickStart3_0/Readme.md).
+
+## To run this example locally
+
+* Create an Application Insights resource in Azure, refer to [Create workspace-based resource](https://docs.microsoft.com/en-us/azure/azure-monitor/app/create-workspace-resource) for instructions.
+ * Note down the connection string.
+
+* Update the connection string in [appsettings.Development.json](appsettings.Development.json).
+
+ ```jsonc
+ {
+ ...
+ "ApplicationInsights": {
+ "ConnectionString": "__ReplaceWithYourConnectionString__"
+ }
+ }
+ ```
+
+* Run the code
+
+ ```shell
+ dotnet run
+ ```
+
+Example of a successful log locally:
+
+```shell
+> PS D:\Repos\profiler\examples\QuickStart3_1> dotnet run
+info: Microsoft.ApplicationInsights.Profiler.Core.IServiceProfilerContext[0]
+ Profiler Endpoint: https://profiler.monitor.azure.com/
+info: Microsoft.ApplicationInsights.Profiler.AspNetCore.ServiceProfilerStartupFilter[0]
+ Starting application insights profiler with instrumentation key: your-ikey-will-show-up-here
+info: Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider[0]
+ Service Profiler session started.
+info: Microsoft.Hosting.Lifetime[0]
+ Now listening on: https://localhost:5001
+info: Microsoft.Hosting.Lifetime[0]
+ Now listening on: http://localhost:5000
+info: Microsoft.Hosting.Lifetime[0]
+ Application started. Press Ctrl+C to shut down.
+info: Microsoft.Hosting.Lifetime[0]
+ Hosting environment: Development
+info: Microsoft.Hosting.Lifetime[0]
+ Content root path: D:\Repos\fork-ai-profiler\examples\QuickStart3_1
+info: Microsoft.ApplicationInsights.Profiler.Core.UploaderProxy.TraceUploaderProxy[0]
+ Finished calling trace uploader. Exit code: 0
+info: Microsoft.ApplicationInsights.Profiler.Core.ServiceProfilerProvider[0]
+ Service Profiler session finished.
+```
diff --git a/examples/QuickStart3_1/Startup.cs b/examples/QuickStart3_1/Startup.cs
new file mode 100644
index 0000000..4d63628
--- /dev/null
+++ b/examples/QuickStart3_1/Startup.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.HttpsPolicy;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+
+namespace QuickStart3_1
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ // This method gets called by the runtime. Use this method to add services to the container.
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddControllers();
+ services.AddApplicationInsightsTelemetry();
+ services.AddServiceProfiler(profilerSettings =>
+ {
+ // Refer to https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/blob/main/Configurations.md for more settings.
+ profilerSettings.Duration=TimeSpan.FromSeconds(60);
+ });
+ }
+
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+
+ app.UseHttpsRedirection();
+
+ app.UseRouting();
+
+ app.UseAuthorization();
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapControllers();
+ });
+ }
+ }
+}
diff --git a/examples/QuickStart3_1/WeatherForecast.cs b/examples/QuickStart3_1/WeatherForecast.cs
new file mode 100644
index 0000000..bcd1c8e
--- /dev/null
+++ b/examples/QuickStart3_1/WeatherForecast.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace QuickStart3_1
+{
+ public class WeatherForecast
+ {
+ public DateTime Date { get; set; }
+
+ public int TemperatureC { get; set; }
+
+ public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+ public string Summary { get; set; }
+ }
+}
diff --git a/examples/QuickStart3_1/appsettings.Development.json b/examples/QuickStart3_1/appsettings.Development.json
new file mode 100644
index 0000000..2c8aace
--- /dev/null
+++ b/examples/QuickStart3_1/appsettings.Development.json
@@ -0,0 +1,13 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information",
+ "Microsoft.ApplicationInsights.Profiler": "Information"
+ }
+ },
+ "ApplicationInsights": {
+ "ConnectionString": "GetTheConnectionStringFromApplicationInsights"
+ }
+}
\ No newline at end of file
diff --git a/examples/QuickStart3_1/appsettings.json b/examples/QuickStart3_1/appsettings.json
new file mode 100644
index 0000000..bbf19c1
--- /dev/null
+++ b/examples/QuickStart3_1/appsettings.json
@@ -0,0 +1,11 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information",
+ "Microsoft.ApplicationInsights.Profiler": "Information"
+ }
+ },
+ "AllowedHosts": "*"
+}
diff --git a/examples/QuickStart3_1/global.json b/examples/QuickStart3_1/global.json
new file mode 100644
index 0000000..e1b3bbb
--- /dev/null
+++ b/examples/QuickStart3_1/global.json
@@ -0,0 +1,5 @@
+{
+ "sdk": {
+ "version": "3.1.407"
+ }
+}
\ No newline at end of file