Browse Source

Added AppInsights service

pull/368/head
Ramón Tomás 7 years ago
parent
commit
a04cef97ef
41 changed files with 188 additions and 24 deletions
  1. +1
    -0
      .env
  2. +11
    -1
      docker-compose.override.yml
  3. +1
    -0
      src/Services/Basket/Basket.API/Basket.API.csproj
  4. +5
    -0
      src/Services/Basket/Basket.API/Program.cs
  5. +8
    -3
      src/Services/Basket/Basket.API/Startup.cs
  6. +4
    -1
      src/Services/Basket/Basket.API/appsettings.json
  7. +1
    -0
      src/Services/Catalog/Catalog.API/Catalog.API.csproj
  8. +7
    -1
      src/Services/Catalog/Catalog.API/Program.cs
  9. +4
    -0
      src/Services/Catalog/Catalog.API/Startup.cs
  10. +4
    -1
      src/Services/Catalog/Catalog.API/appsettings.json
  11. +1
    -0
      src/Services/Identity/Identity.API/Identity.API.csproj
  12. +5
    -0
      src/Services/Identity/Identity.API/Program.cs
  13. +5
    -1
      src/Services/Identity/Identity.API/Startup.cs
  14. +3
    -0
      src/Services/Identity/Identity.API/appsettings.json
  15. +1
    -0
      src/Services/Location/Locations.API/Locations.API.csproj
  16. +8
    -1
      src/Services/Location/Locations.API/Program.cs
  17. +5
    -0
      src/Services/Location/Locations.API/Startup.cs
  18. +4
    -1
      src/Services/Location/Locations.API/appsettings.json
  19. +8
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  20. +9
    -1
      src/Services/Marketing/Marketing.API/Program.cs
  21. +5
    -0
      src/Services/Marketing/Marketing.API/Startup.cs
  22. +6
    -4
      src/Services/Marketing/Marketing.API/appsettings.json
  23. +1
    -0
      src/Services/Ordering/Ordering.API/Ordering.API.csproj
  24. +8
    -1
      src/Services/Ordering/Ordering.API/Program.cs
  25. +5
    -1
      src/Services/Ordering/Ordering.API/Startup.cs
  26. +4
    -1
      src/Services/Ordering/Ordering.API/settings.json
  27. +1
    -0
      src/Services/Payment/Payment.API/Payment.API.csproj
  28. +8
    -1
      src/Services/Payment/Payment.API/Program.cs
  29. +4
    -1
      src/Services/Payment/Payment.API/appsettings.json
  30. +8
    -1
      src/Web/WebMVC/Program.cs
  31. +4
    -0
      src/Web/WebMVC/Startup.cs
  32. +1
    -0
      src/Web/WebMVC/WebMVC.csproj
  33. +3
    -0
      src/Web/WebMVC/appsettings.json
  34. +6
    -0
      src/Web/WebSPA/Program.cs
  35. +6
    -0
      src/Web/WebSPA/Startup.cs
  36. +1
    -0
      src/Web/WebSPA/WebSPA.csproj
  37. +3
    -0
      src/Web/WebSPA/appsettings.json
  38. +8
    -1
      src/Web/WebStatus/Program.cs
  39. +6
    -1
      src/Web/WebStatus/Startup.cs
  40. +1
    -0
      src/Web/WebStatus/WebStatus.csproj
  41. +4
    -1
      src/Web/WebStatus/appsettings.json

+ 1
- 0
.env View File

@ -23,3 +23,4 @@ ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92
#ESHOP_AZURE_STORAGE_MARKETING_KEY=<YourAzureStorageMarketingKey>
#ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows>
#ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows>
#INSTRUMENTATION_KEY=

+ 11
- 1
docker-compose.override.yml View File

@ -19,6 +19,7 @@ services:
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5103:80"
@ -36,6 +37,7 @@ services:
- UseCustomizationData=True
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5101:80"
@ -51,7 +53,8 @@ services:
- MarketingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5110
- BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103
- OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102
- UseCustomizationData=True
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5105:80"
@ -69,6 +72,7 @@ services:
- AzureServiceBusEnabled=False
- CheckUpdateTime=30000
- GracePeriodTime=1
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5102:80"
@ -90,6 +94,7 @@ services:
- AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY}
- AzureServiceBusEnabled=False
- AzureStorageEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5110:80"
@ -110,6 +115,7 @@ services:
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5104:80"
@ -130,6 +136,7 @@ services:
- MarketingUrlHC=http://marketing.api/hc
- PaymentUrlHC=http://payment.api/hc
- UseCustomizationData=True
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5100:80"
@ -146,6 +153,7 @@ services:
- PaymentUrl=http://payment.api/hc
- mvc=http://webmvc/hc
- spa=http://webspa/hc
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5107:80"
@ -157,6 +165,7 @@ services:
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5108:80"
@ -172,6 +181,7 @@ services:
- EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME}
- EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD}
- AzureServiceBusEnabled=False
- ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY}
ports:
- "5109:80"


+ 1
- 0
src/Services/Basket/Basket.API/Basket.API.csproj View File

@ -16,6 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />


+ 5
- 0
src/Services/Basket/Basket.API/Program.cs View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.IO;
@ -23,6 +24,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


+ 8
- 3
src/Services/Basket/Basket.API/Startup.cs View File

@ -43,7 +43,9 @@ 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);
// Add framework services.
services.AddMvc(options =>
{
@ -167,14 +169,17 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
}
app.UseStaticFiles();
app.UseCors("CorsPolicy");


+ 4
- 1
src/Services/Basket/Basket.API/appsettings.json View File

@ -10,5 +10,8 @@
"IdentityUrl": "http://localhost:5105",
"ConnectionString": "127.0.0.1",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Basket"
"SubscriptionClientName": "Basket",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 1
- 0
src/Services/Catalog/Catalog.API/Catalog.API.csproj View File

@ -35,6 +35,7 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />


+ 7
- 1
src/Services/Catalog/Catalog.API/Program.cs View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@ -32,14 +33,19 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseContentRoot(Directory.GetCurrentDirectory())
.UseWebRoot("Pics")
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.UseApplicationInsights()
.Build();
}
}

+ 4
- 0
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -41,6 +41,8 @@
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddHealthChecks(checks =>
{
var minutes = 1;
@ -160,6 +162,8 @@
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 4
- 1
src/Services/Catalog/Catalog.API/appsettings.json View File

@ -12,5 +12,8 @@
},
"AzureServiceBusEnabled": false,
"AzureStorageEnabled": false,
"SubscriptionClientName": "Catalog"
"SubscriptionClientName": "Catalog",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 1
- 0
src/Services/Identity/Identity.API/Identity.API.csproj View File

@ -16,6 +16,7 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0-rc1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0-rc1" />


+ 5
- 0
src/Services/Identity/Identity.API/Program.cs View File

@ -43,12 +43,17 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.UseApplicationInsights()
.Build();
}
}


+ 5
- 1
src/Services/Identity/Identity.API/Startup.cs View File

@ -31,6 +31,8 @@ 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);
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["ConnectionString"],
@ -114,7 +116,9 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();


+ 3
- 0
src/Services/Identity/Identity.API/appsettings.json View File

@ -12,5 +12,8 @@
"System": "Information",
"Microsoft": "Information"
}
},
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 1
- 0
src/Services/Location/Locations.API/Locations.API.csproj View File

@ -11,6 +11,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" />


+ 8
- 1
src/Services/Location/Locations.API/Program.cs View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.IO;
@ -18,11 +19,17 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
})
.UseApplicationInsights()
.Build();
}
}

+ 5
- 0
src/Services/Location/Locations.API/Startup.cs View File

@ -37,6 +37,8 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc(options =>
{
options.Filters.Add(typeof(HttpGlobalExceptionFilter));
@ -142,6 +144,9 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
// 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)
{
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{


+ 4
- 1
src/Services/Location/Locations.API/appsettings.json View File

@ -11,5 +11,8 @@
}
},
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Locations"
"SubscriptionClientName": "Locations",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 8
- 0
src/Services/Marketing/Marketing.API/Marketing.API.csproj View File

@ -7,9 +7,12 @@
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<UserSecretsId>aspnet-Marketing.API-20161122013619</UserSecretsId>
<AssemblyName />
<ApplicationInsightsResourceId>/subscriptions/6c22bb55-0221-4ce4-9bf1-3c4a10a7294c/resourcegroups/eshop-log/providers/microsoft.insights/components/eshopappinsights</ApplicationInsightsResourceId>
<ApplicationInsightsAnnotationResourceId>/subscriptions/6c22bb55-0221-4ce4-9bf1-3c4a10a7294c/resourcegroups/eshop-log/providers/microsoft.insights/components/eshopappinsights</ApplicationInsightsAnnotationResourceId>
</PropertyGroup>
<ItemGroup>
<Folder Include="Connected Services\" />
<Folder Include="Infrastructure\MarketingMigrations\" />
<Content Include="Pics\**\*;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
@ -18,6 +21,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" />
@ -45,4 +49,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>

+ 9
- 1
src/Services/Marketing/Marketing.API/Program.cs View File

@ -3,6 +3,7 @@
using AspNetCore.Hosting;
using Microsoft.AspNetCore;
using Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
@ -25,15 +26,22 @@
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseApplicationInsights()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseWebRoot("Pics")
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
})
.UseApplicationInsights()
.Build();
}
}

+ 5
- 0
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -44,6 +44,8 @@
// This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
// Add framework services.
services.AddMvc(options =>
{
@ -172,6 +174,9 @@
// 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)
{
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 6
- 4
src/Services/Marketing/Marketing.API/appsettings.json View File

@ -1,4 +1,4 @@
{
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
@ -12,6 +12,8 @@
"PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/",
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Marketing",
"AzureStorageEnabled": false
}
"AzureStorageEnabled": false,
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 1
- 0
src/Services/Ordering/Ordering.API/Ordering.API.csproj View File

@ -37,6 +37,7 @@
<PackageReference Include="FluentValidation.MVC6" Version="6.4.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="MediatR" Version="3.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />


+ 8
- 1
src/Services/Ordering/Ordering.API/Program.cs View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@ -30,16 +31,22 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("settings.json");
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.UseApplicationInsights()
.Build();
}
}

+ 5
- 1
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -46,6 +46,8 @@
public IServiceProvider ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
// Add framework services.
services.AddMvc(options =>
{
@ -196,6 +198,8 @@
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
@ -203,7 +207,7 @@
loggerFactory.CreateLogger("init").LogDebug($"Using PATH BASE '{pathBase}'");
app.UsePathBase(pathBase);
}
app.UseCors("CorsPolicy");
ConfigureAuth(app);


+ 4
- 1
src/Services/Ordering/Ordering.API/settings.json View File

@ -13,5 +13,8 @@
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Ordering",
"GracePeriodTime": "1",
"CheckUpdateTime": "30000"
"CheckUpdateTime": "30000",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 1
- 0
src/Services/Payment/Payment.API/Payment.API.csproj View File

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>


+ 8
- 1
src/Services/Payment/Payment.API/Program.cs View File

@ -1,6 +1,7 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.IO;
@ -18,11 +19,17 @@ namespace Payment.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
})
.UseApplicationInsights()
.Build();
}
}

+ 4
- 1
src/Services/Payment/Payment.API/appsettings.json View File

@ -7,5 +7,8 @@
},
"PaymentSucceded": true,
"AzureServiceBusEnabled": false,
"SubscriptionClientName": "Payment"
"SubscriptionClientName": "Payment",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 8
- 1
src/Web/WebMVC/Program.cs View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.IO;
@ -17,11 +18,17 @@ namespace Microsoft.eShopOnContainers.WebMVC
.UseContentRoot(Directory.GetCurrentDirectory())
.UseHealthChecks("/hc")
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
})
.UseApplicationInsights()
.Build();
}
}

+ 4
- 0
src/Web/WebMVC/Startup.cs View File

@ -31,6 +31,8 @@ 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);
services.AddMvc();
services.AddSession();
@ -115,6 +117,8 @@ namespace Microsoft.eShopOnContainers.WebMVC
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment())
{


+ 1
- 0
src/Web/WebMVC/WebMVC.csproj View File

@ -36,6 +36,7 @@
</ItemGroup>-->
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Fabric.MSBuild" Version="1.6.1" />
</ItemGroup>


+ 3
- 0
src/Web/WebMVC/appsettings.json View File

@ -18,5 +18,8 @@
"System": "Information",
"Microsoft": "Information"
}
},
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 6
- 0
src/Web/WebSPA/Program.cs View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Hosting;
using System.IO;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
namespace eShopConContainers.WebSPA
{
@ -17,12 +18,17 @@ namespace eShopConContainers.WebSPA
.UseStartup<Startup>()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
})
.UseApplicationInsights()
.Build();
}
}

+ 6
- 0
src/Web/WebSPA/Startup.cs View File

@ -36,6 +36,8 @@ 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);
services.AddHealthChecks(checks =>
{
var minutes = 1;
@ -76,6 +78,10 @@ namespace eShopConContainers.WebSPA
// 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, IAntiforgery antiforgery)
{
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();


+ 1
- 0
src/Web/WebSPA/WebSPA.csproj View File

@ -27,6 +27,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>


+ 3
- 0
src/Web/WebSPA/appsettings.json View File

@ -15,5 +15,8 @@
"System": "Information",
"Microsoft": "Information"
}
},
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

+ 8
- 1
src/Web/WebStatus/Program.cs View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System.IO;
@ -16,11 +17,17 @@ namespace WebStatus
WebHost.CreateDefaultBuilder(args)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
}).Build();
})
.UseApplicationInsights()
.Build();
}
}

+ 6
- 1
src/Web/WebStatus/Startup.cs View File

@ -23,6 +23,8 @@ 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);
services.AddOptions();
// Add framework services.
@ -49,8 +51,11 @@ namespace WebStatus
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();


+ 1
- 0
src/Web/WebStatus/WebStatus.csproj View File

@ -5,6 +5,7 @@
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup>


+ 4
- 1
src/Web/WebStatus/appsettings.json View File

@ -13,5 +13,8 @@
"IdentityUrl": "http://localhost:5105/hc",
"MarketingUrl": "http://localhost:5110/hc",
"LocationsUrl": "http://localhost:5109/hc",
"PaymentUrl": "http://localhost:5108/hc"
"PaymentUrl": "http://localhost:5108/hc",
"ApplicationInsights": {
"InstrumentationKey": ""
}
}

Loading…
Cancel
Save