diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
index 4d5b1fd92..608fd7a25 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
@@ -13,6 +13,7 @@
+
+
@@ -34,6 +36,7 @@
+
@@ -43,7 +46,9 @@
-
+
+
+
@@ -54,6 +59,7 @@
+
@@ -65,6 +71,7 @@
+
@@ -76,6 +83,7 @@
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
index 1dc7320b1..b73e3d5f7 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
@@ -27,6 +27,8 @@
+
+
@@ -43,3 +45,4 @@
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
index 08fd727ac..f46e22fc7 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
@@ -30,6 +30,8 @@
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
index b576b011d..b67bb16ee 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
@@ -27,7 +27,9 @@
-
+
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
index 286341b5b..61d6b097f 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
@@ -34,6 +34,8 @@
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
index 209f54483..b6820aa70 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
@@ -30,6 +30,8 @@
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
index 1450012ff..2a9a4dfd6 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
@@ -23,7 +23,9 @@
-
+
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
index eb4b31a63..68931e6f4 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
@@ -9,5 +9,6 @@
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml
index 21990aa56..638b70194 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml
@@ -13,6 +13,7 @@
+
-
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
index bb7b033df..d09893cb4 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
@@ -28,6 +28,8 @@
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml b/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
index 6bdcbe2e1..01f86972a 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
@@ -3,5 +3,6 @@
+
\ No newline at end of file
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml
index 1631563e9..7fca0294e 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml
@@ -11,6 +11,7 @@
+
-
+
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml b/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
index 78dd420e4..1c32dd6b0 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
@@ -30,6 +30,8 @@
+
+
diff --git a/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml b/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
index 25352d134..f77d4b08e 100644
--- a/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
+++ b/ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj
index 5e07fbddb..abbbb83e8 100644
--- a/src/Services/Basket/Basket.API/Basket.API.csproj
+++ b/src/Services/Basket/Basket.API/Basket.API.csproj
@@ -19,6 +19,7 @@
+
diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs
index 371979419..190af72ee 100644
--- a/src/Services/Basket/Basket.API/Startup.cs
+++ b/src/Services/Basket/Basket.API/Startup.cs
@@ -3,6 +3,8 @@ using Autofac.Extensions.DependencyInjection;
using Basket.API.Infrastructure.Filters;
using Basket.API.IntegrationEvents.EventHandling;
using Basket.API.IntegrationEvents.Events;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -44,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
+ RegisterAppInsights(services);
// Add framework services.
services.AddMvc(options =>
@@ -63,13 +65,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
);
});
- services.Configure(Configuration);
-
- if(Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ services.Configure(Configuration);
//By connecting here we are making sure that our service
//cannot start until redis is ready. This might slow down startup,
@@ -80,7 +76,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton(sp =>
{
var settings = sp.GetRequiredService>().Value;
- var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
+ var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
configuration.ResolveDns = true;
@@ -111,7 +107,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
HostName = Configuration["EventBusConnection"]
};
- if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) {
+ if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
+ {
factory.UserName = Configuration["EventBusUserName"];
}
@@ -169,7 +166,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton();
services.AddTransient();
services.AddTransient();
-
+
services.AddOptions();
var container = new ContainerBuilder();
@@ -177,8 +174,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new AutofacServiceProvider(container.Build());
}
-
-
+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
@@ -210,6 +206,23 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void ConfigureAuthService(IServiceCollection services)
{
// prevent from mapping "sub" claim to nameidentifier.
diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj
index 5d5812953..4c3640edc 100644
--- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj
+++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj
@@ -38,6 +38,7 @@
+
diff --git a/src/Services/Catalog/Catalog.API/Startup.cs b/src/Services/Catalog/Catalog.API/Startup.cs
index 6dd4f89c5..34738cd58 100644
--- a/src/Services/Catalog/Catalog.API/Startup.cs
+++ b/src/Services/Catalog/Catalog.API/Startup.cs
@@ -4,6 +4,8 @@
using Autofac.Extensions.DependencyInjection;
using global::Catalog.API.Infrastructure.Filters;
using global::Catalog.API.IntegrationEvents;
+ using Microsoft.ApplicationInsights.Extensibility;
+ using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.ServiceBus;
@@ -41,13 +43,7 @@
{
// Add framework services.
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
services.AddHealthChecks(checks =>
{
@@ -208,6 +204,23 @@
ConfigureEventBus(app);
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void RegisterEventBus(IServiceCollection services)
{
if (Configuration.GetValue("AzureServiceBusEnabled"))
diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj
index 69760871e..3f0b4c307 100644
--- a/src/Services/Identity/Identity.API/Identity.API.csproj
+++ b/src/Services/Identity/Identity.API/Identity.API.csproj
@@ -19,6 +19,7 @@
+
diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs
index 8447d3213..dfb368fae 100644
--- a/src/Services/Identity/Identity.API/Startup.cs
+++ b/src/Services/Identity/Identity.API/Startup.cs
@@ -1,6 +1,8 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using IdentityServer4.Services;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
@@ -31,13 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
// Add framework services.
services.AddDbContext(options =>
@@ -163,5 +159,22 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
template: "{controller=Home}/{action=Index}/{id?}");
});
}
+
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
}
}
diff --git a/src/Services/Location/Locations.API/Locations.API.csproj b/src/Services/Location/Locations.API/Locations.API.csproj
index f6a2b0e98..6be9083e3 100644
--- a/src/Services/Location/Locations.API/Locations.API.csproj
+++ b/src/Services/Location/Locations.API/Locations.API.csproj
@@ -14,6 +14,7 @@
+
diff --git a/src/Services/Location/Locations.API/Startup.cs b/src/Services/Location/Locations.API/Startup.cs
index db878a155..d2045e70a 100644
--- a/src/Services/Location/Locations.API/Startup.cs
+++ b/src/Services/Location/Locations.API/Startup.cs
@@ -1,5 +1,7 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -37,13 +39,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
services.AddMvc(options =>
{
@@ -182,6 +178,23 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.Wait();
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void ConfigureAuthService(IServiceCollection services)
{
// prevent from mapping "sub" claim to nameidentifier.
diff --git a/src/Services/Marketing/Marketing.API/Marketing.API.csproj b/src/Services/Marketing/Marketing.API/Marketing.API.csproj
index a462eb04e..2056a0b70 100644
--- a/src/Services/Marketing/Marketing.API/Marketing.API.csproj
+++ b/src/Services/Marketing/Marketing.API/Marketing.API.csproj
@@ -24,6 +24,7 @@
+
diff --git a/src/Services/Marketing/Marketing.API/Startup.cs b/src/Services/Marketing/Marketing.API/Startup.cs
index 76d43d2e3..92bb95aad 100644
--- a/src/Services/Marketing/Marketing.API/Startup.cs
+++ b/src/Services/Marketing/Marketing.API/Startup.cs
@@ -21,6 +21,8 @@
using Infrastructure.Services;
using IntegrationEvents.Events;
using Marketing.API.IntegrationEvents.Handlers;
+ using Microsoft.ApplicationInsights.Extensibility;
+ using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore.Diagnostics;
using RabbitMQ.Client;
@@ -44,13 +46,7 @@
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
// Add framework services.
services.AddMvc(options =>
@@ -213,6 +209,23 @@
ConfigureEventBus(app);
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void ConfigureAuthService(IServiceCollection services)
{
// prevent from mapping "sub" claim to nameidentifier.
diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
index 89a3b81a6..f5c1c5be8 100644
--- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj
+++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj
@@ -40,6 +40,7 @@
+
diff --git a/src/Services/Ordering/Ordering.API/Startup.cs b/src/Services/Ordering/Ordering.API/Startup.cs
index b1dea71b2..b5e2e1729 100644
--- a/src/Services/Ordering/Ordering.API/Startup.cs
+++ b/src/Services/Ordering/Ordering.API/Startup.cs
@@ -10,6 +10,8 @@
using Infrastructure.AutofacModules;
using Infrastructure.Filters;
using Infrastructure.Services;
+ using Microsoft.ApplicationInsights.Extensibility;
+ using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -46,13 +48,7 @@
public IServiceProvider ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
// Add framework services.
services.AddMvc(options =>
@@ -235,6 +231,23 @@
ConfigureEventBus(app);
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void ConfigureEventBus(IApplicationBuilder app)
{
var eventBus = app.ApplicationServices.GetRequiredService();
diff --git a/src/Services/Payment/Payment.API/Payment.API.csproj b/src/Services/Payment/Payment.API/Payment.API.csproj
index 465acae4c..ba82c4215 100644
--- a/src/Services/Payment/Payment.API/Payment.API.csproj
+++ b/src/Services/Payment/Payment.API/Payment.API.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/Services/Payment/Payment.API/Startup.cs b/src/Services/Payment/Payment.API/Startup.cs
index c0ae5b2d5..d3729a6f5 100644
--- a/src/Services/Payment/Payment.API/Startup.cs
+++ b/src/Services/Payment/Payment.API/Startup.cs
@@ -17,6 +17,8 @@ using RabbitMQ.Client;
using System;
using System.Threading.Tasks;
using Swashbuckle.AspNetCore.Swagger;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
namespace Payment.API
{
@@ -31,16 +33,10 @@ namespace Payment.API
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
- {
- services.AddApplicationInsightsTelemetry(Configuration);
-
+ {
services.Configure(Configuration);
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
if (Configuration.GetValue("AzureServiceBusEnabled"))
{
@@ -111,6 +107,23 @@ namespace Payment.API
ConfigureEventBus(app);
}
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
+
private void RegisterEventBus(IServiceCollection services)
{
if (Configuration.GetValue("AzureServiceBusEnabled"))
diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs
index 6049aa229..d90cb82c9 100644
--- a/src/Web/WebMVC/Startup.cs
+++ b/src/Web/WebMVC/Startup.cs
@@ -1,4 +1,6 @@
-using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
+using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -31,13 +33,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
services.AddMvc();
services.AddSession();
@@ -180,5 +176,22 @@ namespace Microsoft.eShopOnContainers.WebMVC
template: "{controller=Error}/{action=Error}");
});
}
+
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
}
}
diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj
index d1a957b27..7bf96b5db 100644
--- a/src/Web/WebMVC/WebMVC.csproj
+++ b/src/Web/WebMVC/WebMVC.csproj
@@ -39,6 +39,7 @@
+
diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs
index 9315088cf..8750d4974 100644
--- a/src/Web/WebSPA/Startup.cs
+++ b/src/Web/WebSPA/Startup.cs
@@ -1,4 +1,6 @@
using eShopOnContainers.WebSPA;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -36,13 +38,7 @@ namespace eShopConContainers.WebSPA
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
services.AddHealthChecks(checks =>
{
@@ -128,11 +124,28 @@ namespace eShopConContainers.WebSPA
await next();
}
});
-
+
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
+
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
}
}
diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj
index f3fa64cdc..308dc5324 100644
--- a/src/Web/WebSPA/WebSPA.csproj
+++ b/src/Web/WebSPA/WebSPA.csproj
@@ -30,6 +30,7 @@
+
diff --git a/src/Web/WebStatus/Startup.cs b/src/Web/WebStatus/Startup.cs
index f869fbb9b..443c660e7 100644
--- a/src/Web/WebStatus/Startup.cs
+++ b/src/Web/WebStatus/Startup.cs
@@ -8,6 +8,8 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WebStatus.Extensions;
+using Microsoft.ApplicationInsights.Extensibility;
+using Microsoft.ApplicationInsights.ServiceFabric;
namespace WebStatus
{
@@ -23,13 +25,7 @@ namespace WebStatus
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddApplicationInsightsTelemetry(Configuration);
-
- if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
- {
- // Enable K8s telemetry initializer
- services.EnableKubernetes();
- }
+ RegisterAppInsights(services);
services.AddOptions();
@@ -87,5 +83,22 @@ namespace WebStatus
template: "{controller=Home}/{action=Index}/{id?}");
});
}
+
+ private void RegisterAppInsights(IServiceCollection services)
+ {
+ services.AddApplicationInsightsTelemetry(Configuration);
+
+ if (Configuration.GetValue("OrchestratorType").Equals("K8S"))
+ {
+ // Enable K8s telemetry initializer
+ services.EnableKubernetes();
+ }
+ if (Configuration.GetValue("OrchestratorType").Equals("SF"))
+ {
+ // Enable SF telemetry initializer
+ services.AddSingleton((serviceProvider) =>
+ new FabricTelemetryInitializer());
+ }
+ }
}
}
diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj
index 9a547e3fc..7a463fe66 100644
--- a/src/Web/WebStatus/WebStatus.csproj
+++ b/src/Web/WebStatus/WebStatus.csproj
@@ -8,6 +8,7 @@
+