mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(logging): ✨ AddApplicationInsightsTelemetry
This commit is contained in:
parent
b6278c6b11
commit
7cdf5fbc75
6 changed files with 13 additions and 0 deletions
2
.env
2
.env
|
|
@ -1,8 +1,10 @@
|
|||
ARCHIVAL_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY=
|
||||
ARCHIVAL_REDIS_CONNECTION_STRING=archival-scheduling-db:6379
|
||||
ARCHIVAL_GIT_REPOSITORY_DIRECTORY=archives
|
||||
ARCHIVAL_GIT_USER_NAME=FilterLists Archival
|
||||
ARCHIVAL_GIT_USER_EMAIL=noreply@filterlists.com
|
||||
|
||||
DIRECTORY_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY=
|
||||
DIRECTORY_CONNECTION_STRING=Server=directory-db;Database=filterlists;User Id=filterlists;Password=filterlists;
|
||||
DIRECTORY_DB_USER=filterlists
|
||||
DIRECTORY_DB_PASSWORD=filterlists
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ services:
|
|||
- archival-scheduling-db
|
||||
- directory-api
|
||||
environment:
|
||||
ApplicationInsights__InstrumentationKey: ${ARCHIVAL_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY}
|
||||
ConnectionStrings__SchedulingConnection: ${ARCHIVAL_REDIS_CONNECTION_STRING}
|
||||
|
||||
archival-scheduling-db:
|
||||
|
|
@ -40,6 +41,7 @@ services:
|
|||
depends_on:
|
||||
- directory-db
|
||||
environment:
|
||||
ApplicationInsights__InstrumentationKey: ${DIRECTORY_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY}
|
||||
ConnectionStrings__DirectoryConnection: ${DIRECTORY_CONNECTION_STRING}
|
||||
|
||||
directory-db:
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public static void AddInfrastructureServices(this IServiceCollection services, I
|
|||
{
|
||||
_ = configuration ?? throw new ArgumentNullException(nameof(configuration));
|
||||
|
||||
services.AddSharedKernelLogging();
|
||||
services.AddPersistenceServices(configuration);
|
||||
services.AddSchedulingServices(configuration);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public static IHostBuilder UseInfrastructure(this IHostBuilder hostBuilder)
|
|||
|
||||
public static void AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddSharedKernelLogging();
|
||||
services.AddDbContextPool<QueryDbContext>(o =>
|
||||
{
|
||||
o.UseNpgsql(configuration.GetConnectionString("DirectoryConnection"),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
|
||||
|
|
@ -11,6 +12,11 @@ public static IHostBuilder UseLogging(this IHostBuilder hostBuilder)
|
|||
return hostBuilder.UseSerilog();
|
||||
}
|
||||
|
||||
public static void AddSharedKernelLogging(this IServiceCollection services)
|
||||
{
|
||||
services.AddApplicationInsightsTelemetry();
|
||||
}
|
||||
|
||||
public static void UseLogging(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseSerilogRequestLogging();
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.14.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
|
|
|||
Loading…
Reference in a new issue