diff --git a/14.-Using-Application-Insights-in-eShopOnContainers.md b/14.-Using-Application-Insights-in-eShopOnContainers.md index 2fd9f95..27787b8 100644 --- a/14.-Using-Application-Insights-in-eShopOnContainers.md +++ b/14.-Using-Application-Insights-in-eShopOnContainers.md @@ -1 +1,69 @@ -TBD \ No newline at end of file +## eShopOnContainers Application Insights + +Follow the steps bellow to configure App Insights as a logging service. It is included the instructions for setting up App Insights in case you decide to register eShopOnContainers logs locally, or for instance in a cluster environment with Kubernetes or Service Fabric. + +### Create an App Insights service +Go to the Azure portal and create the service: +- Create Azure AppInsights +<img src="https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/img/appinsights/create-insights.PNG"> + +In case of using App Insights for logging eShopOnContainers in a cluster environment, Multi-role application map must be enabled: +- Enable Multi-role application map +<img src="https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/img/appinsights/settings-insights.PNG"> + +Retrive the Instrumentation Key generated to be used later on. Go to properties in the portal and copy the key. + +### Setting up Application Insights locally +Open the **.env** file where all the environment variables are set, uncomment the **INSTRUMENTATION_KEY** variable and set the Instrumentation Key from your App Insights service that has previously been created: + +``` +#ESHOP_AZURE_REDIS_BASKET_DB=<YourAzureRedisBasketInfo> +#ESHOP_AZURE_STORAGE_CATALOG_URL=<YourAzureStorage_Catalog_BLOB_URL> +#ESHOP_AZURE_STORAGE_MARKETING_URL=<YourAzureStorage_Marketing__BLOB_URL> +#ESHOP_AZURE_SERVICE_BUS=<YourAzureServiceBusInfo> +#ESHOP_AZURE_COSMOSDB=<YourAzureCosmosDBConnData> +#ESHOP_AZURE_CATALOG_DB=<YourAzureSQLDBCatalogDBConnString> +#ESHOP_AZURE_IDENTITY_DB=<YourAzureSQLDBIdentityDBConnString> +#ESHOP_AZURE_ORDERING_DB=<YourAzureSQLDBOrderingDBConnString> +#ESHOP_AZURE_MARKETING_DB=<YourAzureSQLDBMarketingDBConnString> +#ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI=<YourAzureFunctionCampaignDetailsURI> +#ESHOP_AZURE_STORAGE_CATALOG_NAME=<YourAzureStorageCatalogName> +#ESHOP_AZURE_STORAGE_CATALOG_KEY=<YourAzureStorageCatalogKey> +#ESHOP_AZURE_STORAGE_MARKETING_NAME=<YourAzureStorageMarketingName> +#ESHOP_AZURE_STORAGE_MARKETING_KEY=<YourAzureStorageMarketingKey> +#ESHOP_SERVICE_BUS_USERNAME=<ServiceBusUserName-OnlyUsedIfUsingRabbitMQUnderwindows> +#ESHOP_SERVICE_BUS_PASSWORD=<ServiceBusUserPassword-OnlyUsedIfUsingRabbitMQUnderwindows> +**INSTRUMENTATION_KEY=** +#USE_LOADTEST=<True/False> +``` + +### Setting up Application Insights in Service Fabric +- Retrieve the Instrumentation Key from your AppInsights service properties and set it in the cloud.xml config file of each SF app. +<img src="https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/img/sf/set-instrumentationkey.PNG"> + +### Setting up Application Insights in Kubernetes +- Retrieve the Instrumentation Key from your AppInsights service properties. Open the **conf_local.yml** config file located in '/k8s' directory and set the variable **Instrumentation_Key** with the key. +``` + BasketBus: rabbitmq + BasketRedisConStr: basket-data + CatalogBus: rabbitmq + CatalogSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word; + CatalogAzureStorageEnabled: "False" + IdentitySqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.IdentityDb;User Id=sa;Password=Pass@word; + LocationsBus: rabbitmq + LocationsNoSqlDb: mongodb://nosql-data + LocationsNoSqlDbName: LocationsDb + MarketingBus: rabbitmq + MarketingNoSqlDb: mongodb://nosql-data + MarketingNoSqlDbName: MarketingDb + MarketingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word; + OrderingBus: rabbitmq + OrderingSqlDb: Server=sql-data;Initial Catalog=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word; + PaymentBus: rabbitmq + UseAzureServiceBus: "False" + EnableLoadTest: "False" + keystore: keystore-data + GracePeriodManager_GracePeriodTime: "1" + GracePeriodManager_CheckUpdateTime: "15000" + **Instrumentation_Key: ""** +``` \ No newline at end of file