fixup! fixup! wip: Notifications support through Apprise

Robert Dailey 6 months ago
parent f269b40ee0
commit 38803b32a8

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

Loading…
Cancel
Save