Browse Source

Added eventflow to apps and Services

Added eventflow  k8s settings
Added eventflow  sf win settings
pull/812/head
Ramón Tomás 7 years ago
parent
commit
f5c328f3d5
60 changed files with 439 additions and 50 deletions
  1. +1
    -0
      .env
  2. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
  3. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
  4. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
  5. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
  6. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
  7. +1
    -0
      ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
  8. +1
    -0
      ServiceFabric/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml
  9. +1
    -0
      ServiceFabric/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
  10. +1
    -0
      ServiceFabric/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml
  11. +2
    -2
      deploy/az/servicefabric/WindowsContainers/servicefabricdeploy.parameters.json
  12. +10
    -0
      docker-compose.override.yml
  13. +1
    -0
      k8s/conf_local.yml
  14. +51
    -6
      k8s/deployments.yaml
  15. +5
    -0
      src/Services/Basket/Basket.API/Basket.API.csproj
  16. +6
    -0
      src/Services/Basket/Basket.API/Program.cs
  17. +4
    -1
      src/Services/Basket/Basket.API/Startup.cs
  18. +24
    -0
      src/Services/Basket/Basket.API/eventFlowConfig.json
  19. +5
    -0
      src/Services/Catalog/Catalog.API/Catalog.API.csproj
  20. +1
    -1
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  21. +6
    -0
      src/Services/Catalog/Catalog.API/Program.cs
  22. +3
    -0
      src/Services/Catalog/Catalog.API/Startup.cs
  23. +24
    -0
      src/Services/Catalog/Catalog.API/eventFlowConfig.json
  24. +5
    -0
      src/Services/Identity/Identity.API/Identity.API.csproj
  25. +5
    -0
      src/Services/Identity/Identity.API/Program.cs
  26. +4
    -1
      src/Services/Identity/Identity.API/Startup.cs
  27. +24
    -0
      src/Services/Identity/Identity.API/eventFlowConfig.json
  28. +5
    -0
      src/Services/Location/Locations.API/Locations.API.csproj
  29. +6
    -0
      src/Services/Location/Locations.API/Program.cs
  30. +4
    -0
      src/Services/Location/Locations.API/Startup.cs
  31. +24
    -0
      src/Services/Location/Locations.API/eventFlowConfig.json
  32. +1
    -1
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs
  33. +5
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  34. +6
    -0
      src/Services/Marketing/Marketing.API/Program.cs
  35. +4
    -0
      src/Services/Marketing/Marketing.API/Startup.cs
  36. +24
    -0
      src/Services/Marketing/Marketing.API/eventFlowConfig.json
  37. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/BuyerAndPaymentMethodVerified/UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler.cs
  38. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderGracePeriodConfirmed/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs
  39. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderPaid/OrderStatusChangedToPaidDomainEventHandler.cs
  40. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs
  41. +1
    -1
      src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStockConfirmed/OrderStatusChangedToStockConfirmedDomainEventHandler.cs
  42. +1
    -1
      src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs
  43. +1
    -1
      src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs
  44. +5
    -0
      src/Services/Ordering/Ordering.API/Ordering.API.csproj
  45. +8
    -2
      src/Services/Ordering/Ordering.API/Program.cs
  46. +4
    -1
      src/Services/Ordering/Ordering.API/Startup.cs
  47. +24
    -0
      src/Services/Ordering/Ordering.API/eventFlowConfig.json
  48. +5
    -0
      src/Services/Payment/Payment.API/Payment.API.csproj
  49. +6
    -0
      src/Services/Payment/Payment.API/Program.cs
  50. +7
    -25
      src/Services/Payment/Payment.API/Startup.cs
  51. +24
    -0
      src/Services/Payment/Payment.API/eventFlowConfig.json
  52. +2
    -2
      src/Web/WebMVC/Infrastructure/ResilientHttpClientFactory.cs
  53. +6
    -0
      src/Web/WebMVC/Program.cs
  54. +3
    -0
      src/Web/WebMVC/Startup.cs
  55. +5
    -0
      src/Web/WebMVC/WebMVC.csproj
  56. +24
    -0
      src/Web/WebMVC/eventFlowConfig.json
  57. +6
    -0
      src/Web/WebSPA/Program.cs
  58. +5
    -1
      src/Web/WebSPA/Startup.cs
  59. +5
    -0
      src/Web/WebSPA/WebSPA.csproj
  60. +24
    -0
      src/Web/WebSPA/eventFlowConfig.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=<YourAzure_InstrumentationKey>

+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml View File

@ -30,6 +30,7 @@
<EnvironmentVariable Name="EventBusUserName" Value="admin"/>
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="PATH_BASE" Value="/eShopOnServiceFabric/BasketApi"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml View File

@ -33,6 +33,7 @@
<EnvironmentVariable Name="EventBusUserName" Value="admin"/>
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="PATH_BASE" Value="/eShopOnServiceFabric/CatalogApi"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml View File

@ -31,6 +31,7 @@
<EnvironmentVariable Name="EventBusUserName" Value="admin"/>
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="PATH_BASE" Value="/eShopOnServiceFabric/LocationsApi"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml View File

@ -37,6 +37,7 @@
<EnvironmentVariable Name="MongoConnectionString" Value="mongodb://mongodb.eshoponservicefabric"/>
<EnvironmentVariable Name="MongoDatabase" Value="MarketingDb"/>
<EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml View File

@ -33,6 +33,7 @@
<EnvironmentVariable Name="EventBusUserName" Value="admin"/>
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="PATH_BASE" Value="/eShopOnServiceFabric/OrderingApi"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml View File

@ -27,6 +27,7 @@
<EnvironmentVariable Name="EventBusUserName" Value="admin"/>
<EnvironmentVariable Name="EventBusPassword" Value="password"/>
<EnvironmentVariable Name="PATH_BASE" Value="/eShopOnServiceFabric/PaymentApi"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml View File

@ -32,6 +32,7 @@
<EnvironmentVariable Name="BasketApiClient" Value=""/>
<EnvironmentVariable Name="OrderingApiClient" Value=""/>
<EnvironmentVariable Name="UseCustomizationData" Value="True"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml View File

@ -28,6 +28,7 @@
<EnvironmentVariable Name="IdentityUrl" Value=""/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 1
- 0
ServiceFabric/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml View File

@ -33,6 +33,7 @@
<EnvironmentVariable Name="BasketUrlHC" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="MarketingUrlHC" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="UseCustomizationData" Value="True"/>
<EnvironmentVariable Name="outputs:0:instrumentationKey" Value=""/>
</EnvironmentVariables>
</CodePackage>


+ 2
- 2
deploy/az/servicefabric/WindowsContainers/servicefabricdeploy.parameters.json View File

@ -15,7 +15,7 @@
"value": "eshop"
},
"adminPassword": {
"value": "your_password"
"value": "eshopEshop<<<"
},
"nicName": {
"value": "NIC-eshopsfwin"
@ -24,7 +24,7 @@
"value": "eshopsfwin-PubIP"
},
"dnsName": {
"value": "eshoponservicefabric"
"value": "eshoponsfwinsec"
},
"virtualNetworkName": {
"value": "VNet-eshopsfwin"


+ 10
- 0
docker-compose.override.yml View File

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


+ 1
- 0
k8s/conf_local.yml View File

@ -25,5 +25,6 @@ data:
keystore: keystore-data
GracePeriodManager_GracePeriodTime: "1"
GracePeriodManager_CheckUpdateTime: "15000"
Instrumentation_Key: ""

+ 51
- 6
k8s/deployments.yaml View File

@ -37,6 +37,11 @@ spec:
configMapKeyRef:
name: urls
key: IdentityUrl
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -95,6 +100,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: CatalogBus
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -133,7 +143,7 @@ spec:
env:
- name: PATH_BASE
value: /identity
- name: ConnectionStrings__DefaultConnection
- name: ConnectionString
valueFrom:
configMapKeyRef:
name: externalcfg
@ -174,7 +184,12 @@ spec:
valueFrom:
configMapKeyRef:
name: urls
key: OrderingApiClient
key: OrderingApiClient
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -242,7 +257,12 @@ spec:
valueFrom:
configMapKeyRef:
name: externalcfg
key: GracePeriodManager_GracePeriodTime
key: GracePeriodManager_GracePeriodTime
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -310,7 +330,12 @@ spec:
valueFrom:
configMapKeyRef:
name: urls
key: IdentityUrl
key: IdentityUrl
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -388,7 +413,12 @@ spec:
valueFrom:
configMapKeyRef:
name: urls
key: Marketing_PicBaseUrl
key: Marketing_PicBaseUrl
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -437,6 +467,11 @@ spec:
configMapKeyRef:
name: externalcfg
key: PaymentBus
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -546,7 +581,12 @@ spec:
valueFrom:
configMapKeyRef:
name: urls
key: PaymentHealthCheckUrl
key: PaymentHealthCheckUrl
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:
@ -726,6 +766,11 @@ spec:
configMapKeyRef:
name: urls
key: PaymentHealthCheckUrl
- name: outputs__0__instrumentationKey
valueFrom:
configMapKeyRef:
name: externalcfg
key: Instrumentation_Key
ports:
- containerPort: 80
readinessProbe:


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

@ -18,6 +18,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>


+ 6
- 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,11 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


+ 4
- 1
src/Services/Basket/Basket.API/Startup.cs View File

@ -8,6 +8,8 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.ServiceBus;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
@ -167,8 +169,9 @@ 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.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 24
- 0
src/Services/Basket/Basket.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

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

@ -36,6 +36,11 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
</ItemGroup>


+ 1
- 1
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -374,7 +374,7 @@
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
logger.LogInformation($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}


+ 6
- 0
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;
@ -34,6 +35,11 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseWebRoot("Pics")
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


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

@ -7,6 +7,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.ServiceBus;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
@ -167,6 +169,7 @@
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 24
- 0
src/Services/Catalog/Catalog.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

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

@ -19,6 +19,11 @@
<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" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>


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

@ -43,6 +43,11 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


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

@ -4,6 +4,8 @@ using IdentityServer4.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks;
using Microsoft.eShopOnContainers.Services.Identity.API.Certificates;
@ -98,7 +100,8 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();


+ 24
- 0
src/Services/Identity/Identity.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

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

@ -12,10 +12,15 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.4.4" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUi" Version="1.0.0" />
</ItemGroup>


+ 6
- 0
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,6 +19,11 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


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

@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.ServiceBus;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
@ -142,6 +144,8 @@ 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.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{


+ 24
- 0
src/Services/Location/Locations.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

+ 1
- 1
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs View File

@ -76,7 +76,7 @@
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
logger.LogInformation($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}


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

@ -19,10 +19,15 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="mongocsharpdriver" Version="2.4.4" />
<PackageReference Include="MongoDB.Bson" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver" Version="2.4.4" />
<PackageReference Include="MongoDB.Driver.Core" Version="2.4.4" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>


+ 6
- 0
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;
@ -29,6 +30,11 @@
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseWebRoot("Pics")
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


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

@ -22,6 +22,8 @@
using IntegrationEvents.Events;
using Marketing.API.IntegrationEvents.Handlers;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.EntityFrameworkCore.Diagnostics;
using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Swagger;
@ -172,6 +174,8 @@
// 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.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 24
- 0
src/Services/Marketing/Marketing.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/BuyerAndPaymentMethodVerified/UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler.cs View File

@ -32,7 +32,7 @@ namespace Ordering.API.Application.DomainEventHandlers.BuyerAndPaymentMethodVeri
orderToUpdate.SetPaymentId(buyerPaymentMethodVerifiedEvent.Payment.Id);
_logger.CreateLogger(nameof(UpdateOrderWhenBuyerAndPaymentMethodVerifiedDomainEventHandler))
.LogTrace($"Order with Id: {buyerPaymentMethodVerifiedEvent.OrderId} has been successfully updated with a payment method id: { buyerPaymentMethodVerifiedEvent.Payment.Id }");
.LogInformation($"Order with Id: {buyerPaymentMethodVerifiedEvent.OrderId} has been successfully updated with a payment method id: { buyerPaymentMethodVerifiedEvent.Payment.Id }");
}
}
}

+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderGracePeriodConfirmed/OrderStatusChangedToAwaitingValidationDomainEventHandler.cs View File

@ -29,7 +29,7 @@
public async Task Handle(OrderStatusChangedToAwaitingValidationDomainEvent orderStatusChangedToAwaitingValidationDomainEvent)
{
_logger.CreateLogger(nameof(OrderStatusChangedToAwaitingValidationDomainEvent))
.LogTrace($"Order with Id: {orderStatusChangedToAwaitingValidationDomainEvent.OrderId} has been successfully updated with " +
.LogInformation($"Order with Id: {orderStatusChangedToAwaitingValidationDomainEvent.OrderId} has been successfully updated with " +
$"a status order id: {OrderStatus.AwaitingValidation.Id}");
var orderStockList = orderStatusChangedToAwaitingValidationDomainEvent.OrderItems


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderPaid/OrderStatusChangedToPaidDomainEventHandler.cs View File

@ -29,7 +29,7 @@
public async Task Handle(OrderStatusChangedToPaidDomainEvent orderStatusChangedToPaidDomainEvent)
{
_logger.CreateLogger(nameof(OrderStatusChangedToPaidDomainEventHandler))
.LogTrace($"Order with Id: {orderStatusChangedToPaidDomainEvent.OrderId} has been successfully updated with " +
.LogInformation($"Order with Id: {orderStatusChangedToPaidDomainEvent.OrderId} has been successfully updated with " +
$"a status order id: {OrderStatus.Paid.Id}");
var orderStockList = orderStatusChangedToPaidDomainEvent.OrderItems


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStartedEvent/ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler.cs View File

@ -47,7 +47,7 @@ namespace Ordering.API.Application.DomainEventHandlers.OrderStartedEvent
await _buyerRepository.UnitOfWork
.SaveEntitiesAsync();
_logger.CreateLogger(nameof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler)).LogTrace($"Buyer {buyerUpdated.Id} and related payment method were validated or updated for orderId: {orderStartedEvent.Order.Id}.");
_logger.CreateLogger(nameof(ValidateOrAddBuyerAggregateWhenOrderStartedDomainEventHandler)).LogInformation($"Buyer {buyerUpdated.Id} and related payment method were validated or updated for orderId: {orderStartedEvent.Order.Id}.");
}
}
}

+ 1
- 1
src/Services/Ordering/Ordering.API/Application/DomainEventHandlers/OrderStockConfirmed/OrderStatusChangedToStockConfirmedDomainEventHandler.cs View File

@ -28,7 +28,7 @@
public async Task Handle(OrderStatusChangedToStockConfirmedDomainEvent orderStatusChangedToStockConfirmedDomainEvent)
{
_logger.CreateLogger(nameof(OrderStatusChangedToStockConfirmedDomainEventHandler))
.LogTrace($"Order with Id: {orderStatusChangedToStockConfirmedDomainEvent.OrderId} has been successfully updated with " +
.LogInformation($"Order with Id: {orderStatusChangedToStockConfirmedDomainEvent.OrderId} has been successfully updated with " +
$"a status order id: {OrderStatus.StockConfirmed.Id}");
var orderStatusChangedToStockConfirmedIntegrationEvent = new OrderStatusChangedToStockConfirmedIntegrationEvent(orderStatusChangedToStockConfirmedDomainEvent.OrderId);


+ 1
- 1
src/Services/Ordering/Ordering.API/Application/IntegrationEvents/EventHandling/UserCheckoutAcceptedIntegrationEventHandler.cs View File

@ -51,7 +51,7 @@ namespace Ordering.API.Application.IntegrationEvents.EventHandling
}
_logger.CreateLogger(nameof(UserCheckoutAcceptedIntegrationEventHandler))
.LogTrace(result ? $"UserCheckoutAccepted integration event has been received and a create new order process is started with requestId: {eventMsg.RequestId}" :
.LogInformation(result ? $"UserCheckoutAccepted integration event has been received and a create new order process is started with requestId: {eventMsg.RequestId}" :
$"UserCheckoutAccepted integration event has been received but a new order process has failed with requestId: {eventMsg.RequestId}");
}
}

+ 1
- 1
src/Services/Ordering/Ordering.API/Infrastructure/OrderingContextSeed.cs View File

@ -188,7 +188,7 @@
sleepDurationProvider: retry => TimeSpan.FromSeconds(5),
onRetry: (exception, timeSpan, retry, ctx) =>
{
logger.LogTrace($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
logger.LogInformation($"[{prefix}] Exception {exception.GetType().Name} with message ${exception.Message} detected on attempt {retry} of {retries}");
}
);
}


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

@ -39,6 +39,11 @@
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="MediatR" Version="3.0.1" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="Dapper" Version="1.50.2" />


+ 8
- 2
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;
@ -25,7 +26,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
.SeedAsync(context, env, settings, logger)
.Wait();
})
.MigrateDbContext<IntegrationEventLogContext>((_,__)=>{})
.MigrateDbContext<IntegrationEventLogContext>((_,__)=>{})
.Run();
}
@ -34,11 +35,16 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API
.UseStartup<Startup>()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
builder.AddConsole();
builder.AddDebug();
builder.AddDebug();
})
.Build();
}


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

@ -14,6 +14,8 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.ServiceBus;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
@ -88,7 +90,7 @@
opts.MigrationsAssembly("Ordering.API");
});
});
services.Configure<OrderingSettings>(Configuration);
@ -193,6 +195,7 @@
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))


+ 24
- 0
src/Services/Ordering/Ordering.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

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

@ -9,6 +9,11 @@
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="4.1.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
</ItemGroup>
<ItemGroup>


+ 6
- 0
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,6 +19,11 @@ namespace Payment.API
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


+ 7
- 25
src/Services/Payment/Payment.API/Startup.cs View File

@ -3,6 +3,8 @@ using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.ServiceBus;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
@ -16,7 +18,6 @@ using Payment.API.IntegrationEvents.Events;
using RabbitMQ.Client;
using System;
using System.Threading.Tasks;
using Swashbuckle.AspNetCore.Swagger;
namespace Payment.API
{
@ -75,20 +76,7 @@ namespace Payment.API
{
checks.AddValueTaskCheck("HTTP Endpoint", () => new ValueTask<IHealthCheckResult>(HealthCheckResult.Healthy("Ok")));
});
// Add framework services.
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
{
Title = "eShopOnContainers - Payment HTTP API",
Version = "v1",
Description = "The Payment Microservice HTTP API. This is a Data-Driven/CRUD microservice sample",
TermsOfService = "Terms Of Service"
});
});
RegisterEventBus(services);
var container = new ContainerBuilder();
@ -97,22 +85,16 @@ namespace Payment.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.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
var pathBase = Configuration["PATH_BASE"];
if (!string.IsNullOrEmpty(pathBase))
{
app.UsePathBase(pathBase);
}
app.UseMvcWithDefaultRoute();
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "My API V1");
});
ConfigureEventBus(app);
}


+ 24
- 0
src/Services/Payment/Payment.API/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

+ 2
- 2
src/Web/WebMVC/Infrastructure/ResilientHttpClientFactory.cs View File

@ -44,12 +44,12 @@ namespace Microsoft.eShopOnContainers.WebMVC.Infrastructure
(exception, duration) =>
{
// on circuit opened
_logger.LogTrace("Circuit breaker opened");
_logger.LogInformation("Circuit breaker opened");
},
() =>
{
// on circuit closed
_logger.LogTrace("Circuit breaker reset");
_logger.LogInformation("Circuit breaker reset");
})
};
}


+ 6
- 0
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,6 +18,11 @@ namespace Microsoft.eShopOnContainers.WebMVC
.UseContentRoot(Directory.GetCurrentDirectory())
.UseHealthChecks("/hc")
.UseStartup<Startup>()
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


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

@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.eShopOnContainers.BuildingBlocks;
using Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http;
using Microsoft.eShopOnContainers.WebMVC.Infrastructure;
@ -115,6 +117,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
loggerFactory.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
if (env.IsDevelopment())
{


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

@ -37,7 +37,12 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Fabric.MSBuild" Version="1.6.1" />
<PackageReference Include="NEST" Version="5.5.0" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">


+ 24
- 0
src/Web/WebMVC/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

+ 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,6 +18,11 @@ namespace eShopConContainers.WebSPA
.UseStartup<Startup>()
.UseHealthChecks("/hc")
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((builderContext, config) =>
{
config.AddJsonFile("eventFlowConfig.json", optional: true, reloadOnChange: true);
config.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, builder) =>
{
builder.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));


+ 5
- 1
src/Web/WebSPA/Startup.cs View File

@ -2,6 +2,8 @@
using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Diagnostics.EventFlow;
using Microsoft.Diagnostics.EventFlow.Inputs;
using Microsoft.eShopOnContainers.BuildingBlocks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -78,9 +80,11 @@ namespace eShopConContainers.WebSPA
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDeveloperExceptionPage();
}
loggerFactory.AddEventFlow(DiagnosticPipelineFactory.CreatePipeline(Configuration));
// Configure XSRF middleware, This pattern is for SPA style applications where XSRF token is added on Index page
// load and passed back token on every subsequent async request
// app.Use(async (context, next) =>


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

@ -28,6 +28,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow" Version="1.1.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Inputs.MicrosoftLogging" Version="1.1.3" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Diagnostics.EventFlow.Outputs.StdOutput" Version="1.1.0" />
<PackageReference Include="NEST" Version="5.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
</ItemGroup>


+ 24
- 0
src/Web/WebSPA/eventFlowConfig.json View File

@ -0,0 +1,24 @@
{
"inputs": [
{
"type": "Microsoft.Extensions.Logging"
}
],
"filters": [
],
"outputs": [
{
"type": "ApplicationInsights",
"instrumentationKey": ""
},
{
"type": "StdOutput"
}
],
"schemaVersion": "2016-08-11",
"extensions": [],
"healthReporter": {
"type": "CsvHealthReporter",
"logFileFolder": "/app/log"
}
}

Loading…
Cancel
Save