AppCenter to AppInsights migration. (#562)

* Remove AppCenter usage and libraries.

* Remove redundant pacakges and add the app insights sink.

* Diagnostic id support and manipulating telemetries.

* Handling of appdomain unhandled exceptions.

* Remove unused package identity package from mail project.

* Fixing printing.
This commit is contained in:
Burak Kaan Köse
2025-02-16 01:44:41 +01:00
committed by GitHub
parent f0e513bf0d
commit c1336428dc
27 changed files with 160 additions and 134 deletions

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Serilog.Events;
using Serilog.Sinks.ApplicationInsights.TelemetryConverters;
namespace Wino.Services.Misc
{
internal class WinoTelemetryConverter : EventTelemetryConverter
{
private readonly string _userDiagnosticId;
public WinoTelemetryConverter(string userDiagnosticId)
{
_userDiagnosticId = userDiagnosticId;
}
public override IEnumerable<ITelemetry> Convert(LogEvent logEvent, IFormatProvider formatProvider)
{
foreach (ITelemetry telemetry in base.Convert(logEvent, formatProvider))
{
// Assign diagnostic id as user id.
telemetry.Context.User.Id = _userDiagnosticId;
yield return telemetry;
}
}
public override void ForwardPropertiesToTelemetryProperties(LogEvent logEvent, ISupportProperties telemetryProperties, IFormatProvider formatProvider)
{
ForwardPropertiesToTelemetryProperties(logEvent, telemetryProperties, formatProvider,
includeLogLevel: true,
includeRenderedMessage: true,
includeMessageTemplate: false);
}
}
}