mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
Revert "fix(logging): 🐛🚧 revert to InMemoryChannel to try fix AppInsights logging"
This reverts commit ed7f1164f3.
This commit is contained in:
parent
ed7f1164f3
commit
690d1791e1
5 changed files with 31 additions and 0 deletions
2
.env
2
.env
|
|
@ -1,3 +1,5 @@
|
|||
APPLICATION_INSIGHTS_SERVER_TELEMETRY_CHANNEL_STORAGE_PATH=application-insights
|
||||
|
||||
ARCHIVAL_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY=
|
||||
ARCHIVAL_REDIS_CONNECTION_STRING=archival-scheduling-db:6379
|
||||
ARCHIVAL_GIT_REPOSITORY_PATH=archives
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ services:
|
|||
depends_on:
|
||||
- archival-scheduling-db
|
||||
volumes:
|
||||
- archival-application-insights:/app/${APPLICATION_INSIGHTS_SERVER_TELEMETRY_CHANNEL_STORAGE_PATH}
|
||||
- archival-archives:/app/${ARCHIVAL_GIT_REPOSITORY_PATH}
|
||||
environment:
|
||||
ApplicationInsights__ServerTelemetryChannelStoragePath: ${APPLICATION_INSIGHTS_SERVER_TELEMETRY_CHANNEL_STORAGE_PATH}
|
||||
ApplicationInsights__InstrumentationKey: ${ARCHIVAL_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY}
|
||||
ConnectionStrings__SchedulingConnection: ${ARCHIVAL_REDIS_CONNECTION_STRING}
|
||||
Api__DirectoryHost: ${DIRECTORY_HOST}
|
||||
|
|
@ -48,7 +50,10 @@ services:
|
|||
directory:
|
||||
depends_on:
|
||||
- directory-db
|
||||
volumes:
|
||||
- directory-application-insights:/app/${APPLICATION_INSIGHTS_SERVER_TELEMETRY_CHANNEL_STORAGE_PATH}
|
||||
environment:
|
||||
ApplicationInsights__ServerTelemetryChannelStoragePath: ${APPLICATION_INSIGHTS_SERVER_TELEMETRY_CHANNEL_STORAGE_PATH}
|
||||
ApplicationInsights__InstrumentationKey: ${DIRECTORY_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY}
|
||||
ConnectionStrings__DirectoryConnection: ${DIRECTORY_CONNECTION_STRING}
|
||||
|
||||
|
|
@ -70,6 +75,8 @@ networks:
|
|||
directory:
|
||||
|
||||
volumes:
|
||||
archival-application-insights:
|
||||
archival-scheduling-db:
|
||||
archival-archives:
|
||||
directory-application-insights:
|
||||
directory-db:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
{
|
||||
"_comment": "Used only for managing EF migrations. All other configuration is done via environment variables.",
|
||||
"ApplicationInsights": {
|
||||
"ServerTelemetryChannelStoragePath": "application-insights"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"DirectoryConnection": "Server=directory-db;Database=filterlists;User Id=filterlists;Password=filterlists;"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
using System;
|
||||
using FilterLists.SharedKernel.Logging.Options;
|
||||
using Microsoft.ApplicationInsights.Channel;
|
||||
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -18,6 +21,13 @@ public static void AddSharedKernelLogging(this IServiceCollection services, ICon
|
|||
{
|
||||
_ = configuration ?? throw new ArgumentNullException(nameof(configuration));
|
||||
|
||||
using var serverTelemetryChannel = new ServerTelemetryChannel
|
||||
{
|
||||
StorageFolder = configuration.GetSection(ApplicationInsightsOptions.Key)
|
||||
.Get<ApplicationInsightsOptions>()
|
||||
.ServerTelemetryChannelStoragePath
|
||||
};
|
||||
services.AddSingleton(typeof(ITelemetryChannel), serverTelemetryChannel);
|
||||
services.AddApplicationInsightsTelemetry();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
namespace FilterLists.SharedKernel.Logging.Options
|
||||
{
|
||||
internal class ApplicationInsightsOptions
|
||||
{
|
||||
public const string Key = "ApplicationInsights";
|
||||
|
||||
public string ServerTelemetryChannelStoragePath { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue