mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-11-15 08:56:27 +01:00
Time series metrics
This commit is contained in:
@@ -14,6 +14,7 @@ public class InMemoryStatsController : IStatsCollector, IStatsReporter
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask TrackIngress(Guid id, ulong amount)
|
||||
{
|
||||
Incr(IngressKey(id), amount);
|
||||
@@ -21,6 +22,7 @@ public class InMemoryStatsController : IStatsCollector, IStatsReporter
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask TrackEgress(Guid id, ulong amount)
|
||||
{
|
||||
Incr(EgressKey(id), amount);
|
||||
@@ -28,12 +30,27 @@ public class InMemoryStatsController : IStatsCollector, IStatsReporter
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask<Bandwidth> GetBandwidth()
|
||||
=> ValueTask.FromResult(GetBandwidthInternal(Global));
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask<IReadOnlyList<BandwidthPoint>> GetBandwidth(DateTime start, DateTime end)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask<Bandwidth> GetBandwidth(Guid id)
|
||||
=> ValueTask.FromResult(GetBandwidthInternal(id));
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask<IReadOnlyList<BandwidthPoint>> GetBandwidth(Guid id, DateTime start, DateTime end)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ValueTask Delete(Guid id)
|
||||
{
|
||||
_cache.Remove(EgressKey(id));
|
||||
@@ -56,4 +73,4 @@ public class InMemoryStatsController : IStatsCollector, IStatsReporter
|
||||
|
||||
private string IngressKey(Guid id) => $"stats:ingress:{id}";
|
||||
private string EgressKey(Guid id) => $"stats:egress:{id}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user