This commit is contained in:
Janus C. H. Knudsen 2025-03-10 15:56:22 +01:00
parent f3ab94eff1
commit 31666b4ba0
34 changed files with 140 additions and 83 deletions

View file

@ -1,5 +1,5 @@
using Autofac;
using PlanTempus.Core.Logging;
using PlanTempus.Core.SeqLogging;
namespace PlanTempus.Core.ModuleRegistry
{

View file

@ -10,13 +10,12 @@ namespace PlanTempus.Core.ModuleRegistry
protected override void Load(ContainerBuilder builder)
{
var configuration = TelemetryConfiguration.CreateDefault();
configuration.ConnectionString = TelemetryConfig.ConnectionString;
configuration.TelemetryChannel.DeveloperMode = true;
var client = new Microsoft.ApplicationInsights.TelemetryClient(configuration);
client.Context.GlobalProperties["Application"] = GetType().Namespace.Split('.')[0];
client.Context.GlobalProperties["Application"] = GetType().Namespace?.Split('.')[0];
client.Context.GlobalProperties["MachineName"] = Environment.MachineName;
client.Context.GlobalProperties["Version"] = Environment.Version.ToString();
client.Context.GlobalProperties["ProcessorCount"] = Environment.ProcessorCount.ToString();
@ -34,10 +33,11 @@ namespace PlanTempus.Core.ModuleRegistry
configuration.TelemetryChannel = new Telemetry.SeqTelemetryChannel(messageChannel, client);
}
var telemetryProcessorChain = new Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder(configuration);
var telemetryProcessorChain =
new Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryProcessorChainBuilder(
configuration);
telemetryProcessorChain.Use(next => new Telemetry.Enrichers.EnrichWithMetaTelemetry(next));
telemetryProcessorChain.Build();
}
}
@ -46,4 +46,4 @@ namespace PlanTempus.Core.ModuleRegistry
public string ConnectionString { get; set; }
public bool UseSeqLoggingTelemetryChannel { get; set; }
}
}
}