fixup! fixup! wip: Notifications support through Apprise

Robert Dailey 6 months ago
parent 3684290eef
commit 570c56cda1

@ -1,6 +1,7 @@
using System.Diagnostics.Metrics;
using System.Text;
using Flurl.Http;
using Recyclarr.Common.Extensions;
using Recyclarr.Http;
using Recyclarr.Notifications.Apprise;
using Recyclarr.Notifications.Apprise.Dto;
@ -83,9 +84,28 @@ public sealed class NotificationService(
public sealed class NotificationScope : IDisposable
{
public NotificationScope(MeterListener meterListener)
private readonly MeterListener _meterListener = new();
public NotificationScope()
{
_meterListener.InstrumentPublished = (instrument, listener) =>
{
if (instrument.Meter.Name.StartsWithIgnoreCase("recyclarr."))
{
listener.EnableMeasurementEvents(instrument);
}
};
_meterListener.SetMeasurementEventCallback<int>(OnMeasurementRecorded);
}
private void OnMeasurementRecorded(
Instrument instrument,
int measurement,
ReadOnlySpan<KeyValuePair<string, object?>> tags,
object? state)
{
// var meter = meterFactory.Create(instanceName);
throw new NotImplementedException();
}
public void ObtainCapturedMetrics()
@ -96,6 +116,6 @@ public sealed class NotificationScope : IDisposable
public void Dispose()
{
// TODO
_meterListener.Dispose();
}
}

Loading…
Cancel
Save