feat(logging): configure Application Insights ServerTelemetryChannel directory

This commit is contained in:
Collin M. Barrett 2020-09-10 20:49:39 -05:00
parent e901699a6b
commit 0acdaa1b5c
2 changed files with 11 additions and 1 deletions

View file

@ -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:

View file

@ -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();
}