Browse Source

Added Appinsights Linux SF telemetry initializer

pull/365/head
Ramón Tomás 7 years ago
parent
commit
dc98e6a4c6
40 changed files with 267 additions and 84 deletions
  1. +9
    -1
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml
  2. +3
    -0
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/BasketApiPkg/ServiceManifest.xml
  3. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/CatalogApiPkg/ServiceManifest.xml
  4. +3
    -1
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/LocationsApiPkg/ServiceManifest.xml
  5. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/MarketingApiPkg/ServiceManifest.xml
  6. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/OrderingApiPkg/ServiceManifest.xml
  7. +3
    -1
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/PaymentApiPkg/ServiceManifest.xml
  8. +1
    -0
      ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml
  9. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml
  10. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/IdentityApiPkg/ServiceManifest.xml
  11. +1
    -0
      ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml
  12. +3
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/ApplicationManifest.xml
  13. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/WebMVCPkg/ServiceManifest.xml
  14. +1
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml
  15. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml
  16. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/WebSPAPkg/ServiceManifest.xml
  17. +1
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml
  18. +4
    -1
      ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/ApplicationManifest.xml
  19. +2
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml
  20. +1
    -0
      ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml
  21. +1
    -0
      src/Services/Basket/Basket.API/Basket.API.csproj
  22. +26
    -13
      src/Services/Basket/Basket.API/Startup.cs
  23. +1
    -0
      src/Services/Catalog/Catalog.API/Catalog.API.csproj
  24. +20
    -7
      src/Services/Catalog/Catalog.API/Startup.cs
  25. +1
    -0
      src/Services/Identity/Identity.API/Identity.API.csproj
  26. +20
    -7
      src/Services/Identity/Identity.API/Startup.cs
  27. +1
    -0
      src/Services/Location/Locations.API/Locations.API.csproj
  28. +20
    -7
      src/Services/Location/Locations.API/Startup.cs
  29. +1
    -0
      src/Services/Marketing/Marketing.API/Marketing.API.csproj
  30. +20
    -7
      src/Services/Marketing/Marketing.API/Startup.cs
  31. +1
    -0
      src/Services/Ordering/Ordering.API/Ordering.API.csproj
  32. +20
    -7
      src/Services/Ordering/Ordering.API/Startup.cs
  33. +1
    -0
      src/Services/Payment/Payment.API/Payment.API.csproj
  34. +21
    -8
      src/Services/Payment/Payment.API/Startup.cs
  35. +21
    -8
      src/Web/WebMVC/Startup.cs
  36. +1
    -0
      src/Web/WebMVC/WebMVC.csproj
  37. +21
    -8
      src/Web/WebSPA/Startup.cs
  38. +1
    -0
      src/Web/WebSPA/WebSPA.csproj
  39. +20
    -7
      src/Web/WebStatus/Startup.cs
  40. +1
    -0
      src/Web/WebStatus/WebStatus.csproj

+ 9
- 1
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -13,6 +13,7 @@
<Parameter Name="BasketApi_InstanceCount" DefaultValue="-1" /> <Parameter Name="BasketApi_InstanceCount" DefaultValue="-1" />
<Parameter Name="IdentityUrlExternal" DefaultValue="" /> <Parameter Name="IdentityUrlExternal" DefaultValue="" />
<Parameter Name="PicBaseUrl" DefaultValue="" /> <Parameter Name="PicBaseUrl" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters> </Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
should match the Name and Version attributes of the ServiceManifest element defined in the should match the Name and Version attributes of the ServiceManifest element defined in the
@ -23,6 +24,7 @@
<!-- Override external urls depending on environment --> <!-- Override external urls depending on environment -->
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/> <EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
@ -34,6 +36,7 @@
<ServiceManifestRef ServiceManifestName="LocationsApiPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="LocationsApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/> <EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
@ -43,7 +46,9 @@
</ServiceManifestImport> </ServiceManifestImport>
<ServiceManifestImport> <ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="PaymentApiPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="PaymentApiPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="80" EndpointRef="PaymentApiTypeEndpoint"/> <PortBinding ContainerPort="80" EndpointRef="PaymentApiTypeEndpoint"/>
@ -54,6 +59,7 @@
<ServiceManifestRef ServiceManifestName="OrderingApiPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="OrderingApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/> <EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
@ -65,6 +71,7 @@
<ServiceManifestRef ServiceManifestName="CatalogApiPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="CatalogApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrl]"/> <EnvironmentVariable Name="PicBaseUrl" Value="[PicBaseUrl]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
@ -76,6 +83,7 @@
<ServiceManifestRef ServiceManifestName="BasketApiPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="BasketApiPkg" ServiceManifestVersion="1.0.0" />
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/> <EnvironmentVariable Name="IdentityUrlExternal" Value="[IdentityUrlExternal]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">


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

@ -27,6 +27,8 @@
<EnvironmentVariable Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105"/> <EnvironmentVariable Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105"/>
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/> <EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/> <EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>
@ -43,3 +45,4 @@
</Endpoints> </Endpoints>
</Resources> </Resources>
</ServiceManifest> </ServiceManifest>

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

@ -30,6 +30,8 @@
<EnvironmentVariable Name="AzureStorageEnabled" Value="False"/> <EnvironmentVariable Name="AzureStorageEnabled" Value="False"/>
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/> <EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/> <EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


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

@ -27,7 +27,9 @@
<EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/> <EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="IdentityUrlExternal" Value=""/> <EnvironmentVariable Name="IdentityUrlExternal" Value=""/>
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/> <EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


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

@ -34,6 +34,8 @@
<EnvironmentVariable Name="MongoConnectionString" Value="mongodb://mongodb.eshoponservicefabricnosql"/> <EnvironmentVariable Name="MongoConnectionString" Value="mongodb://mongodb.eshoponservicefabricnosql"/>
<EnvironmentVariable Name="MongoDatabase" Value="MarketingDb"/> <EnvironmentVariable Name="MongoDatabase" Value="MarketingDb"/>
<EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/> <EnvironmentVariable Name="identityUrl" Value="http://identityapi.eshoponservicefabric:5105"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


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

@ -30,6 +30,8 @@
<EnvironmentVariable Name="UseCustomizationData" Value="True"/> <EnvironmentVariable Name="UseCustomizationData" Value="True"/>
<EnvironmentVariable Name="GracePeriodTime" Value="1"/> <EnvironmentVariable Name="GracePeriodTime" Value="1"/>
<EnvironmentVariable Name="CheckUpdateTime" Value="30000"/> <EnvironmentVariable Name="CheckUpdateTime" Value="30000"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


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

@ -23,7 +23,9 @@
<EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/> <EnvironmentVariable Name="ASPNETCORE_ENVIRONMENT" Value="Development"/>
<EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/> <EnvironmentVariable Name="ASPNETCORE_URLS" Value="http://0.0.0.0:80"/>
<EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/> <EnvironmentVariable Name="EventBusConnection" Value="rabbitmq.eshoponservicefabricbus"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="AzureServiceBusEnabled" Value="False"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


+ 1
- 0
ServiceFabric/Linux/eShopOnServiceFabric/ApplicationParameters/Cloud.xml View File

@ -9,5 +9,6 @@
<Parameter Name="BasketApi_InstanceCount" Value="-1" /> <Parameter Name="BasketApi_InstanceCount" Value="-1" />
<Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" /> <Parameter Name="IdentityUrlExternal" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" /> <Parameter Name="PicBaseUrl" Value="http://#{your_sf_dns}#:5101/api/v1/catalog/items/[0]/pic/" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters> </Parameters>
</Application> </Application>

+ 2
- 0
ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -13,6 +13,7 @@
<Parameter Name="MarketingApiClient" DefaultValue="" /> <Parameter Name="MarketingApiClient" DefaultValue="" />
<Parameter Name="BasketApiClient" DefaultValue="" /> <Parameter Name="BasketApiClient" DefaultValue="" />
<Parameter Name="OrderingApiClient" DefaultValue="" /> <Parameter Name="OrderingApiClient" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters> </Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
should match the Name and Version attributes of the ServiceManifest element defined in the should match the Name and Version attributes of the ServiceManifest element defined in the
@ -28,6 +29,7 @@
<EnvironmentVariable Name="MarketingApiClient" Value="[MarketingApiClient]"/> <EnvironmentVariable Name="MarketingApiClient" Value="[MarketingApiClient]"/>
<EnvironmentVariable Name="BasketApiClient" Value="[BasketApiClient]"/> <EnvironmentVariable Name="BasketApiClient" Value="[BasketApiClient]"/>
<EnvironmentVariable Name="OrderingApiClient" Value="[OrderingApiClient]"/> <EnvironmentVariable Name="OrderingApiClient" Value="[OrderingApiClient]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">


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

@ -32,6 +32,8 @@
<EnvironmentVariable Name="BasketApiClient" Value=""/> <EnvironmentVariable Name="BasketApiClient" Value=""/>
<EnvironmentVariable Name="OrderingApiClient" Value=""/> <EnvironmentVariable Name="OrderingApiClient" Value=""/>
<EnvironmentVariable Name="UseCustomizationData" Value="True"/> <EnvironmentVariable Name="UseCustomizationData" Value="True"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


+ 1
- 0
ServiceFabric/Linux/eShopOnServiceFabricIdSrv/eShopOnServiceFabricIdSrv/ApplicationParameters/Cloud.xml View File

@ -9,5 +9,6 @@
<Parameter Name="MarketingApiClient" Value="http://#{your_sf_dns}#:5110" /> <Parameter Name="MarketingApiClient" Value="http://#{your_sf_dns}#:5110" />
<Parameter Name="BasketApiClient" Value="http://#{your_sf_dns}#:5103" /> <Parameter Name="BasketApiClient" Value="http://#{your_sf_dns}#:5103" />
<Parameter Name="OrderingApiClient" Value="http://#{your_sf_dns}#:5102" /> <Parameter Name="OrderingApiClient" Value="http://#{your_sf_dns}#:5102" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters> </Parameters>
</Application> </Application>

+ 3
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -7,6 +7,7 @@
<Parameters> <Parameters>
<Parameter Name="WebMVC_InstanceCount" DefaultValue="-1" /> <Parameter Name="WebMVC_InstanceCount" DefaultValue="-1" />
<Parameter Name="IdentityUrl" DefaultValue="" /> <Parameter Name="IdentityUrl" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters> </Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
should match the Name and Version attributes of the ServiceManifest element defined in the should match the Name and Version attributes of the ServiceManifest element defined in the
@ -15,7 +16,8 @@
<ServiceManifestRef ServiceManifestName="WebMVCPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="WebMVCPkg" ServiceManifestVersion="1.0.0" />
<!-- Override external urls depending on environment --> <!-- Override external urls depending on environment -->
<EnvironmentOverrides CodePackageRef="Code"> <EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="IdentityUrl" Value="[IdentityUrl]"/>
<EnvironmentVariable Name="IdentityUrl" Value="[IdentityUrl]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">


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

@ -28,6 +28,8 @@
<EnvironmentVariable Name="IdentityUrl" Value=""/> <EnvironmentVariable Name="IdentityUrl" Value=""/>
<EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/> <EnvironmentVariable Name="MarketingUrl" Value="http://marketingapi.eshoponservicefabric:5110"/>
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/> <EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


+ 1
- 0
ServiceFabric/Linux/eShopOnServiceFabricWebMVC/eShopOnServiceFabricWebMVC/ApplicationParameters/Cloud.xml View File

@ -3,5 +3,6 @@
<Parameters> <Parameters>
<Parameter Name="WebMVC_InstanceCount" Value="-1" /> <Parameter Name="WebMVC_InstanceCount" Value="-1" />
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" /> <Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters> </Parameters>
</Application> </Application>

+ 2
- 0
ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -11,6 +11,7 @@
<Parameter Name="BasketUrl" DefaultValue="" /> <Parameter Name="BasketUrl" DefaultValue="" />
<Parameter Name="MarketingUrl" DefaultValue="" /> <Parameter Name="MarketingUrl" DefaultValue="" />
<Parameter Name="IdentityUrl" DefaultValue="" /> <Parameter Name="IdentityUrl" DefaultValue="" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters> </Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
should match the Name and Version attributes of the ServiceManifest element defined in the should match the Name and Version attributes of the ServiceManifest element defined in the
@ -24,6 +25,7 @@
<EnvironmentVariable Name="BasketUrl" Value="[BasketUrl]"/> <EnvironmentVariable Name="BasketUrl" Value="[BasketUrl]"/>
<EnvironmentVariable Name="MarketingUrl" Value="[MarketingUrl]"/> <EnvironmentVariable Name="MarketingUrl" Value="[MarketingUrl]"/>
<EnvironmentVariable Name="IdentityUrl" Value="[IdentityUrl]"/> <EnvironmentVariable Name="IdentityUrl" Value="[IdentityUrl]"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides> </EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">


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

@ -33,6 +33,8 @@
<EnvironmentVariable Name="BasketUrlHC" Value="http://basketapi.eshoponservicefabric:5103/hc"/> <EnvironmentVariable Name="BasketUrlHC" Value="http://basketapi.eshoponservicefabric:5103/hc"/>
<EnvironmentVariable Name="MarketingUrlHC" Value="http://marketingapi.eshoponservicefabric:5110/hc"/> <EnvironmentVariable Name="MarketingUrlHC" Value="http://marketingapi.eshoponservicefabric:5110/hc"/>
<EnvironmentVariable Name="UseCustomizationData" Value="True"/> <EnvironmentVariable Name="UseCustomizationData" Value="True"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


+ 1
- 0
ServiceFabric/Linux/eShopOnServiceFabricWebSPA/eShopOnServiceFabricWebSPA/ApplicationParameters/Cloud.xml View File

@ -7,5 +7,6 @@
<Parameter Name="BasketUrl" Value="http://#{your_sf_dns}#:5103" /> <Parameter Name="BasketUrl" Value="http://#{your_sf_dns}#:5103" />
<Parameter Name="MarketingUrl" Value="http://#{your_sf_dns}#:5110" /> <Parameter Name="MarketingUrl" Value="http://#{your_sf_dns}#:5110" />
<Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" /> <Parameter Name="IdentityUrl" Value="http://#{your_sf_dns}#:5105" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters> </Parameters>
</Application> </Application>

+ 4
- 1
ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/ApplicationManifest.xml View File

@ -6,13 +6,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters> <Parameters>
<Parameter Name="WebStatus_InstanceCount" DefaultValue="-1" /> <Parameter Name="WebStatus_InstanceCount" DefaultValue="-1" />
<Parameter Name="InstrumentationKey" DefaultValue="" />
</Parameters> </Parameters>
<!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion
should match the Name and Version attributes of the ServiceManifest element defined in the should match the Name and Version attributes of the ServiceManifest element defined in the
ServiceManifest.xml file. --> ServiceManifest.xml file. -->
<ServiceManifestImport> <ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="WebStatusPkg" ServiceManifestVersion="1.0.0" /> <ServiceManifestRef ServiceManifestName="WebStatusPkg" ServiceManifestVersion="1.0.0" />
<ConfigOverrides />
<EnvironmentOverrides CodePackageRef="Code">
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value="[InstrumentationKey]"/>
</EnvironmentOverrides>
<Policies> <Policies>
<ContainerHostPolicies CodePackageRef="Code"> <ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="80" EndpointRef="WebStatusTypeEndpoint"/> <PortBinding ContainerPort="80" EndpointRef="WebStatusTypeEndpoint"/>


+ 2
- 0
ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationPackageRoot/WebStatusPkg/ServiceManifest.xml View File

@ -30,6 +30,8 @@
<EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/> <EnvironmentVariable Name="LocationsUrl" Value="http://locationsapi.eshoponservicefabric:5109"/>
<EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100"/> <EnvironmentVariable Name="mvc" Value="http://webmvc.eshoponservicefabric:5100"/>
<EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104"/> <EnvironmentVariable Name="spa" Value="http://webspa.eshoponservicefabric:5104"/>
<EnvironmentVariable Name="ApplicationInsights__InstrumentationKey" Value=""/>
<EnvironmentVariable Name="OrchestratorType" Value="SF"/>
</EnvironmentVariables> </EnvironmentVariables>
</CodePackage> </CodePackage>


+ 1
- 0
ServiceFabric/Linux/eShopOnServiceFabricWebStatus/eShopOnServiceFabricWebStatus/ApplicationParameters/Cloud.xml View File

@ -2,5 +2,6 @@
<Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Application Name="fabric:/eShopOnServiceFabricWebStatus" xmlns="http://schemas.microsoft.com/2011/01/fabric" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Parameters> <Parameters>
<Parameter Name="WebStatus_InstanceCount" Value="-1" /> <Parameter Name="WebStatus_InstanceCount" Value="-1" />
<Parameter Name="InstrumentationKey" Value="" />
</Parameters> </Parameters>
</Application> </Application>

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

@ -19,6 +19,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" />


+ 26
- 13
src/Services/Basket/Basket.API/Startup.cs View File

@ -3,6 +3,8 @@ using Autofac.Extensions.DependencyInjection;
using Basket.API.Infrastructure.Filters; using Basket.API.Infrastructure.Filters;
using Basket.API.IntegrationEvents.EventHandling; using Basket.API.IntegrationEvents.EventHandling;
using Basket.API.IntegrationEvents.Events; using Basket.API.IntegrationEvents.Events;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -44,7 +46,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
// This method gets called by the runtime. Use this method to add services to the container. // 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);
RegisterAppInsights(services);
// Add framework services. // Add framework services.
services.AddMvc(options => services.AddMvc(options =>
@ -63,13 +65,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
); );
}); });
services.Configure<BasketSettings>(Configuration);
if(Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
services.Configure<BasketSettings>(Configuration);
//By connecting here we are making sure that our service //By connecting here we are making sure that our service
//cannot start until redis is ready. This might slow down startup, //cannot start until redis is ready. This might slow down startup,
@ -80,7 +76,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton<ConnectionMultiplexer>(sp => services.AddSingleton<ConnectionMultiplexer>(sp =>
{ {
var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value; var settings = sp.GetRequiredService<IOptions<BasketSettings>>().Value;
var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
var configuration = ConfigurationOptions.Parse(settings.ConnectionString, true);
configuration.ResolveDns = true; configuration.ResolveDns = true;
@ -111,7 +107,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
HostName = Configuration["EventBusConnection"] HostName = Configuration["EventBusConnection"]
}; };
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"])) {
if (!string.IsNullOrEmpty(Configuration["EventBusUserName"]))
{
factory.UserName = Configuration["EventBusUserName"]; factory.UserName = Configuration["EventBusUserName"];
} }
@ -169,7 +166,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddTransient<IBasketRepository, RedisBasketRepository>(); services.AddTransient<IBasketRepository, RedisBasketRepository>();
services.AddTransient<IIdentityService, IdentityService>(); services.AddTransient<IIdentityService, IdentityService>();
services.AddOptions(); services.AddOptions();
var container = new ContainerBuilder(); var container = new ContainerBuilder();
@ -177,8 +174,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
return new AutofacServiceProvider(container.Build()); return new AutofacServiceProvider(container.Build());
} }
// 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)
@ -210,6 +206,23 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void ConfigureAuthService(IServiceCollection services) private void ConfigureAuthService(IServiceCollection services)
{ {
// prevent from mapping "sub" claim to nameidentifier. // prevent from mapping "sub" claim to nameidentifier.


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

@ -38,6 +38,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" />


+ 20
- 7
src/Services/Catalog/Catalog.API/Startup.cs View File

@ -4,6 +4,8 @@
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using global::Catalog.API.Infrastructure.Filters; using global::Catalog.API.Infrastructure.Filters;
using global::Catalog.API.IntegrationEvents; using global::Catalog.API.IntegrationEvents;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.ServiceBus; using Microsoft.Azure.ServiceBus;
@ -41,13 +43,7 @@
{ {
// Add framework services. // Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
services.AddHealthChecks(checks => services.AddHealthChecks(checks =>
{ {
@ -208,6 +204,23 @@
ConfigureEventBus(app); ConfigureEventBus(app);
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)
{ {
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))


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

@ -19,6 +19,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" /> <PackageReference Include="IdentityServer4.AspNetIdentity" Version="2.0.0" />
<PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0" /> <PackageReference Include="IdentityServer4.EntityFramework" Version="2.0.0" />


+ 20
- 7
src/Services/Identity/Identity.API/Startup.cs View File

@ -1,6 +1,8 @@
using Autofac; using Autofac;
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using IdentityServer4.Services; using IdentityServer4.Services;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
@ -31,13 +33,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
// This method gets called by the runtime. Use this method to add services to the container. // 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);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
// Add framework services. // Add framework services.
services.AddDbContext<ApplicationDbContext>(options => services.AddDbContext<ApplicationDbContext>(options =>
@ -163,5 +159,22 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API
template: "{controller=Home}/{action=Index}/{id?}"); template: "{controller=Home}/{action=Index}/{id?}");
}); });
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
} }
} }

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

@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" />


+ 20
- 7
src/Services/Location/Locations.API/Startup.cs View File

@ -1,5 +1,7 @@
using Autofac; using Autofac;
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -37,13 +39,7 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
services.AddMvc(options => services.AddMvc(options =>
{ {
@ -182,6 +178,23 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API
.Wait(); .Wait();
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void ConfigureAuthService(IServiceCollection services) private void ConfigureAuthService(IServiceCollection services)
{ {
// prevent from mapping "sub" claim to nameidentifier. // prevent from mapping "sub" claim to nameidentifier.


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

@ -24,6 +24,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" />


+ 20
- 7
src/Services/Marketing/Marketing.API/Startup.cs View File

@ -21,6 +21,8 @@
using Infrastructure.Services; using Infrastructure.Services;
using IntegrationEvents.Events; using IntegrationEvents.Events;
using Marketing.API.IntegrationEvents.Handlers; using Marketing.API.IntegrationEvents.Handlers;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Diagnostics;
using RabbitMQ.Client; using RabbitMQ.Client;
@ -44,13 +46,7 @@
// 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);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
// Add framework services. // Add framework services.
services.AddMvc(options => services.AddMvc(options =>
@ -213,6 +209,23 @@
ConfigureEventBus(app); ConfigureEventBus(app);
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void ConfigureAuthService(IServiceCollection services) private void ConfigureAuthService(IServiceCollection services)
{ {
// prevent from mapping "sub" claim to nameidentifier. // prevent from mapping "sub" claim to nameidentifier.


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

@ -40,6 +40,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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" />


+ 20
- 7
src/Services/Ordering/Ordering.API/Startup.cs View File

@ -10,6 +10,8 @@
using Infrastructure.AutofacModules; using Infrastructure.AutofacModules;
using Infrastructure.Filters; using Infrastructure.Filters;
using Infrastructure.Services; using Infrastructure.Services;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -46,13 +48,7 @@
public IServiceProvider ConfigureServices(IServiceCollection services) public IServiceProvider ConfigureServices(IServiceCollection services)
{ {
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
// Add framework services. // Add framework services.
services.AddMvc(options => services.AddMvc(options =>
@ -235,6 +231,23 @@
ConfigureEventBus(app); ConfigureEventBus(app);
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void ConfigureEventBus(IApplicationBuilder app) private void ConfigureEventBus(IApplicationBuilder app)
{ {
var eventBus = app.ApplicationServices.GetRequiredService<BuildingBlocks.EventBus.Abstractions.IEventBus>(); var eventBus = app.ApplicationServices.GetRequiredService<BuildingBlocks.EventBus.Abstractions.IEventBus>();


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

@ -11,6 +11,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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>


+ 21
- 8
src/Services/Payment/Payment.API/Startup.cs View File

@ -17,6 +17,8 @@ using RabbitMQ.Client;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.Swagger;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
namespace Payment.API namespace Payment.API
{ {
@ -31,16 +33,10 @@ namespace Payment.API
// This method gets called by the runtime. Use this method to add services to the container. // 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);
{
services.Configure<PaymentSettings>(Configuration); services.Configure<PaymentSettings>(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))
{ {
@ -111,6 +107,23 @@ namespace Payment.API
ConfigureEventBus(app); ConfigureEventBus(app);
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
private void RegisterEventBus(IServiceCollection services) private void RegisterEventBus(IServiceCollection services)
{ {
if (Configuration.GetValue<bool>("AzureServiceBusEnabled")) if (Configuration.GetValue<bool>("AzureServiceBusEnabled"))


+ 21
- 8
src/Web/WebMVC/Startup.cs View File

@ -1,4 +1,6 @@
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -31,13 +33,7 @@ namespace Microsoft.eShopOnContainers.WebMVC
// This method gets called by the runtime. Use this method to add services to the container. // 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);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
services.AddMvc(); services.AddMvc();
services.AddSession(); services.AddSession();
@ -180,5 +176,22 @@ namespace Microsoft.eShopOnContainers.WebMVC
template: "{controller=Error}/{action=Error}"); template: "{controller=Error}/{action=Error}");
}); });
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
} }
} }

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

@ -39,6 +39,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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>


+ 21
- 8
src/Web/WebSPA/Startup.cs View File

@ -1,4 +1,6 @@
using eShopOnContainers.WebSPA; using eShopOnContainers.WebSPA;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
using Microsoft.AspNetCore.Antiforgery; using Microsoft.AspNetCore.Antiforgery;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -36,13 +38,7 @@ namespace eShopConContainers.WebSPA
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 // 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);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
services.AddHealthChecks(checks => services.AddHealthChecks(checks =>
{ {
@ -128,11 +124,28 @@ namespace eShopConContainers.WebSPA
await next(); await next();
} }
}); });
app.UseDefaultFiles(); app.UseDefaultFiles();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseMvcWithDefaultRoute(); app.UseMvcWithDefaultRoute();
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
} }
} }

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

@ -30,6 +30,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<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>


+ 20
- 7
src/Web/WebStatus/Startup.cs View File

@ -8,6 +8,8 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using WebStatus.Extensions; using WebStatus.Extensions;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.ServiceFabric;
namespace WebStatus namespace WebStatus
{ {
@ -23,13 +25,7 @@ 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);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
RegisterAppInsights(services);
services.AddOptions(); services.AddOptions();
@ -87,5 +83,22 @@ namespace WebStatus
template: "{controller=Home}/{action=Index}/{id?}"); template: "{controller=Home}/{action=Index}/{id?}");
}); });
} }
private void RegisterAppInsights(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(Configuration);
if (Configuration.GetValue<string>("OrchestratorType").Equals("K8S"))
{
// Enable K8s telemetry initializer
services.EnableKubernetes();
}
if (Configuration.GetValue<string>("OrchestratorType").Equals("SF"))
{
// Enable SF telemetry initializer
services.AddSingleton<ITelemetryInitializer>((serviceProvider) =>
new FabricTelemetryInitializer());
}
}
} }
} }

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

@ -8,6 +8,7 @@
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" /> <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" /> <PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.4.1" />
<PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" /> <PackageReference Include="Microsoft.ApplicationInsights.Kubernetes" Version="1.0.0-beta1" />
<PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric" Version="2.0.0-beta1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>


Loading…
Cancel
Save