Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor improve in ApplicationInsights

support903e4a0b28fc
diff --git a/src/Web/Grand.Web.Common/Grand.Web.Common.csproj b/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
index 3296c6f8d..b8e195b63 100644
--- a/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
+++ b/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
@@ -5,6 +5,7 @@
<PackageReference Include="Azure.Extensions.AspNetCore.DataProtection.Keys" Version="1.2.2" />
<PackageReference Include="Azure.Identity" Version="1.10.4" />
<PackageReference Include="Flurl.Http" Version="4.0.2" />
+ <PackageReference Include="Microsoft.ApplicationInsights.Profiler.AspNetCore" Version="2.6.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" Version="8.0.0" />
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.21.0" />
diff --git a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
index 08614836d..f5fcb8aa4 100644
--- a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
+++ b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
@@ -297,6 +297,7 @@ namespace Grand.Web.Common.Infrastructure
if (!string.IsNullOrEmpty(applicationInsights.ConnectionString))
{
services.AddApplicationInsightsTelemetry();
+ services.AddServiceProfiler();
services.AddLogging(builder =>
{
builder.AddApplicationInsights(
diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.json
index 7ec32ffca..4d1c8fa2a 100644
--- a/src/Web/Grand.Web/App_Data/appsettings.json
+++ b/src/Web/Grand.Web/App_Data/appsettings.json
@@ -254,5 +254,13 @@
},
"ApplicationInsights": {
"ConnectionString": ""
+ },
+ //https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/blob/main/Configurations.md
+ "ServiceProfiler": {
+ "IsDisabled": true,
+ "Duration": "00:00:30",
+ "InitialDelay": "00:00:03",
+ "ProvideAnonymousTelemetry": true,
+ "IsSkipCompatibilityTest": false
}
}