a fork of iceshrimp.net but a tweaked frontend to my personal liking. waow
fediverse social-media social iceshrimp fedi
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[backend/services] Convert Telemetry into a SingleService so Dispose gets called automatically on app shutdown

+6 -15
-1
Iceshrimp.Backend/Core/Extensions/ApplicationBuilderExtensions.cs
··· 1 1 using Iceshrimp.Backend.Core.Configuration; 2 2 using Iceshrimp.Backend.Core.Helpers; 3 - using Iceshrimp.Backend.Core.Services; 4 3 using Npgsql; 5 4 using OpenTelemetry.Logs; 6 5 using OpenTelemetry.Metrics;
-1
Iceshrimp.Backend/Core/Federation/ActivityStreams/LdHelpers.cs
··· 4 4 using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types; 5 5 using Iceshrimp.Backend.Core.Federation.Cryptography; 6 6 using Iceshrimp.Backend.Core.Helpers; 7 - using Iceshrimp.Shared.Helpers; 8 7 using Newtonsoft.Json; 9 8 using Newtonsoft.Json.Linq; 10 9 using VDS.RDF.JsonLd;
+3 -2
Iceshrimp.Backend/Core/Helpers/Telemetry.cs
··· 1 1 using System.Diagnostics; 2 2 using System.Diagnostics.Metrics; 3 + using Iceshrimp.Backend.Core.Extensions; 3 4 using Iceshrimp.Shared.Helpers; 4 5 5 6 namespace Iceshrimp.Backend.Core.Helpers; ··· 10 11 /// It is recommended to use a custom type to hold references for ActivitySource. 11 12 /// This avoids possible type collisions with other components in the DI container. 12 13 /// </summary> 13 - public static class Telemetry 14 + public sealed class Telemetry : IDisposable, ISingletonService 14 15 { 15 16 public const string Source = "Iceshrimp.NET"; 16 17 17 18 public static ActivitySource ActivitySource { get; } = new(Source, VersionHelpers.VersionInfo.Value.Version); 18 19 public static Meter Meter { get; } = new(Source, VersionHelpers.VersionInfo.Value.Version); 19 20 20 - public static void Dispose() 21 + public void Dispose() 21 22 { 22 23 ActivitySource.Dispose(); 23 24 Meter.Dispose();
+3 -11
Iceshrimp.Backend/Startup.cs
··· 2 2 using System.Net; 3 3 using Iceshrimp.Backend.Core.Extensions; 4 4 using Iceshrimp.Backend.Core.Helpers; 5 - using Iceshrimp.Backend.Core.Services; 6 5 using Iceshrimp.Backend.Pages.Shared; 7 6 using Iceshrimp.Backend.SignalR; 8 7 using Iceshrimp.Backend.SignalR.Authentication; ··· 99 98 var elapsed = (DateTime.Now - Process.GetCurrentProcess().StartTime).GetTotalMilliseconds(); 100 99 app.Logger.LogInformation("Startup complete after {ms} ms.", elapsed); 101 100 102 - try 103 - { 104 - await app.StartAsync(); 105 - app.SetKestrelUnixSocketPermissions(); 106 - await app.WaitForShutdownAsync(); 107 - } 108 - finally 109 - { 110 - Telemetry.Dispose(); 111 - } 101 + await app.StartAsync(); 102 + app.SetKestrelUnixSocketPermissions(); 103 + await app.WaitForShutdownAsync();