From 0acdaa1b5c9391fb0eb89475327afed7d23d78cc Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Thu, 10 Sep 2020 20:49:39 -0500 Subject: [PATCH] =?UTF-8?q?feat(logging):=20=E2=9C=A8=20configure=20Applic?= =?UTF-8?q?ation=20Insights=20ServerTelemetryChannel=20directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 6 ++++++ .../ConfigurationExtensions.cs | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 505a78c1e..d6effee06 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,8 @@ services: depends_on: - archival-scheduling-db - directory-api + volumes: + - archival-application-insights:/app/application-insights environment: ApplicationInsights__InstrumentationKey: ${ARCHIVAL_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY} ConnectionStrings__SchedulingConnection: ${ARCHIVAL_REDIS_CONNECTION_STRING} @@ -40,6 +42,8 @@ services: - directory depends_on: - directory-db + volumes: + - directory-application-insights:/app/application-insights environment: ApplicationInsights__InstrumentationKey: ${DIRECTORY_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY} ConnectionStrings__DirectoryConnection: ${DIRECTORY_CONNECTION_STRING} @@ -62,5 +66,7 @@ networks: directory: volumes: + archival-application-insights: archival-scheduling-db: + directory-application-insights: directory-db: diff --git a/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationExtensions.cs b/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationExtensions.cs index f04f3e505..b3bdc9662 100644 --- a/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationExtensions.cs +++ b/services/SharedKernel/FilterLists.SharedKernel.Logging/ConfigurationExtensions.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Builder; +using Microsoft.ApplicationInsights.Channel; +using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; @@ -14,6 +16,8 @@ public static IHostBuilder UseLogging(this IHostBuilder hostBuilder) public static void AddSharedKernelLogging(this IServiceCollection services) { + using var serverTelemetryChannel = new ServerTelemetryChannel {StorageFolder = "application-insights"}; + services.AddSingleton(typeof(ITelemetryChannel), serverTelemetryChannel); services.AddApplicationInsightsTelemetry(); }