Added AppInsights service

This commit is contained in:
Ramón Tomás 2017-10-11 16:26:44 +02:00
parent 373bdd9896
commit a04cef97ef
41 changed files with 188 additions and 24 deletions

1
.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_AZURE_STORAGE_MARKETING_KEY=<YourAzureStorageMarketingKey>
#ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows> #ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows>
#ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows> #ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows>
#INSTRUMENTATION_KEY=

View File

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

View File

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

View File

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

View File

@ -44,6 +44,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
// Add framework services. // Add framework services.
services.AddMvc(options => 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. // 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"]; var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase)) if (!string.IsNullOrEmpty(pathBase))
{ {
app.UsePathBase(pathBase); app.UsePathBase(pathBase);
} }
app.UseStaticFiles(); app.UseStaticFiles();
app.UseCors("CorsPolicy"); app.UseCors("CorsPolicy");

View File

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

View File

@ -35,6 +35,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" /> <PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />

View File

@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure; using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -34,12 +35,17 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
.UseHealthChecks("/hc") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseWebRoot("Pics") .UseWebRoot("Pics")
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) => .ConfigureLogging((hostingContext, builder) =>
{ {
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole(); builder.AddConsole();
builder.AddDebug(); builder.AddDebug();
}) })
.UseApplicationInsights()
.Build(); .Build();
} }
} }

View File

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

View File

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

View File

@ -16,6 +16,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0-rc1" /> <PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0-rc1" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0-rc1" /> <PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0-rc1" />

View File

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

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. // This method gets called by the runtime. Use this method to add services to the container.
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
// Add framework services. // Add framework services.
services.AddDbContext<ApplicationDbContext>(options => services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["ConnectionString"], options.UseSqlServer(Configuration["ConnectionString"],
@ -114,6 +116,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{ {
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {

View File

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

View File

@ -11,6 +11,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" /> <PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" /> <PackageReference Include="MongoDB.Bson" Version="2.4.4" />

View File

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

View File

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

View File

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

View File

@ -7,9 +7,12 @@
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<UserSecretsId>aspnet-Marketing.API-20161122013619</UserSecretsId> <UserSecretsId>aspnet-Marketing.API-20161122013619</UserSecretsId>
<AssemblyName /> <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> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Connected Services\" />
<Folder Include="Infrastructure\MarketingMigrations\" /> <Folder Include="Infrastructure\MarketingMigrations\" />
<Content Include="Pics\**\*;"> <Content Include="Pics\**\*;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
@ -18,6 +21,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" /> <PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" /> <PackageReference Include="MongoDB.Bson" Version="2.4.4" />
@ -45,4 +49,8 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project> </Project>

View File

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

View File

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

View File

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

View File

@ -37,6 +37,7 @@
<PackageReference Include="FluentValidation.MVC6" Version="6.4.0" /> <PackageReference Include="FluentValidation.MVC6" Version="6.4.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="3.0.0" /> <PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="MediatR" Version="3.0.1" /> <PackageReference Include="MediatR" Version="3.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF; using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure; using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure;
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure; using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -34,12 +35,18 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
.UseStartup<Startup>() .UseStartup<Startup>()
.UseHealthChecks("/hc") .UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("settings.json");
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) => .ConfigureLogging((hostingContext, builder) =>
{ {
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole(); builder.AddConsole();
builder.AddDebug(); builder.AddDebug();
}) })
.UseApplicationInsights()
.Build(); .Build();
} }
} }

View File

@ -46,6 +46,8 @@
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
// Add framework services. // Add framework services.
services.AddMvc(options => services.AddMvc(options =>
{ {
@ -196,6 +198,8 @@
{ {
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
var pathBase = Configuration["PATH_BASE"]; var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase)) if (!string.IsNullOrEmpty(pathBase))

View File

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

View File

@ -8,6 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.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="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup> </ItemGroup>

View File

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

View File

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

View File

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

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. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc(); services.AddMvc();
services.AddSession(); services.AddSession();
@ -115,6 +117,8 @@ namespace Microsoft.eShopOnContainers.WebMVC
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {

View File

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

View File

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

View File

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

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 // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
services.AddHealthChecks(checks => services.AddHealthChecks(checks =>
{ {
var minutes = 1; 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. // 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) public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAntiforgery antiforgery)
{ {
loggerFactory.AddAzureWebAppDiagnostics();
loggerFactory.AddApplicationInsights(app.ApplicationServices, LogLevel.Trace);
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();

View File

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

View File

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

View File

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

View File

@ -23,6 +23,8 @@ namespace WebStatus
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
services.AddOptions(); services.AddOptions();
// Add framework services. // 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. // 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()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();

View File

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

View File

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