mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
warmup QuickPulseTelemetryModule in AddLogging() rather than Main()
This commit is contained in:
parent
3ec400e501
commit
1a3e7b8dc0
2 changed files with 7 additions and 7 deletions
|
|
@ -8,6 +8,7 @@
|
|||
using FilterLists.Agent.Infrastructure.Polly;
|
||||
using FilterLists.Agent.Infrastructure.Web;
|
||||
using MediatR;
|
||||
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Serilog;
|
||||
|
|
@ -58,8 +59,12 @@ private static void AddLogging(this IServiceCollection services)
|
|||
{
|
||||
services.AddLogging(b =>
|
||||
{
|
||||
var telemetryClient = b.Services.BuildServiceProvider().GetService<AgentTelemetryClient>()
|
||||
.TelemetryClient;
|
||||
var serviceProvider = b.Services.BuildServiceProvider();
|
||||
|
||||
// init never-resolved singleton
|
||||
serviceProvider.GetService<QuickPulseTelemetryModule>();
|
||||
|
||||
var telemetryClient = serviceProvider.GetService<AgentTelemetryClient>().TelemetryClient;
|
||||
b.AddSerilog(new LoggerConfiguration()
|
||||
.WriteTo.Console()
|
||||
.WriteTo.ApplicationInsights(telemetryClient, TelemetryConverter.Traces)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
using FilterLists.Agent.Features.Urls;
|
||||
using FilterLists.Agent.Infrastructure.DependencyInjection;
|
||||
using MediatR;
|
||||
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace FilterLists.Agent
|
||||
|
|
@ -17,10 +16,6 @@ public static class Program
|
|||
public static async Task Main(string[] args)
|
||||
{
|
||||
_serviceProvider = ServiceProviderBuilder.Build();
|
||||
|
||||
// init never-resolved singleton
|
||||
_serviceProvider.GetService<QuickPulseTelemetryModule>();
|
||||
|
||||
var parser = _serviceProvider.GetService<Parser>();
|
||||
var mediator = _serviceProvider.GetService<IMediator>();
|
||||
await parser.ParseArguments<CommandLineOptions>(args).MapResult(async o =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue