Restructure solution layout by module
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Diagnostics.Metrics;
|
||||
|
||||
namespace StellaOps.Scanner.Cache;
|
||||
|
||||
public static class ScannerCacheMetrics
|
||||
{
|
||||
public const string MeterName = "StellaOps.Scanner.Cache";
|
||||
|
||||
private static readonly Meter Meter = new(MeterName, "1.0.0");
|
||||
|
||||
private static readonly Counter<long> LayerHits = Meter.CreateCounter<long>("scanner.layer_cache_hits_total");
|
||||
private static readonly Counter<long> LayerMisses = Meter.CreateCounter<long>("scanner.layer_cache_misses_total");
|
||||
private static readonly Counter<long> LayerEvictions = Meter.CreateCounter<long>("scanner.layer_cache_evictions_total");
|
||||
private static readonly Histogram<long> LayerBytes = Meter.CreateHistogram<long>("scanner.layer_cache_bytes");
|
||||
private static readonly Counter<long> FileCasHits = Meter.CreateCounter<long>("scanner.file_cas_hits_total");
|
||||
private static readonly Counter<long> FileCasMisses = Meter.CreateCounter<long>("scanner.file_cas_misses_total");
|
||||
private static readonly Counter<long> FileCasEvictions = Meter.CreateCounter<long>("scanner.file_cas_evictions_total");
|
||||
private static readonly Histogram<long> FileCasBytes = Meter.CreateHistogram<long>("scanner.file_cas_bytes");
|
||||
|
||||
public static void RecordLayerHit(string layerDigest)
|
||||
=> LayerHits.Add(1, new KeyValuePair<string, object?>("layer", layerDigest));
|
||||
|
||||
public static void RecordLayerMiss(string layerDigest)
|
||||
=> LayerMisses.Add(1, new KeyValuePair<string, object?>("layer", layerDigest));
|
||||
|
||||
public static void RecordLayerEviction(string layerDigest)
|
||||
=> LayerEvictions.Add(1, new KeyValuePair<string, object?>("layer", layerDigest));
|
||||
|
||||
public static void RecordLayerBytes(long bytes)
|
||||
=> LayerBytes.Record(bytes);
|
||||
|
||||
public static void RecordFileCasHit(string sha256)
|
||||
=> FileCasHits.Add(1, new KeyValuePair<string, object?>("sha256", sha256));
|
||||
|
||||
public static void RecordFileCasMiss(string sha256)
|
||||
=> FileCasMisses.Add(1, new KeyValuePair<string, object?>("sha256", sha256));
|
||||
|
||||
public static void RecordFileCasEviction(string sha256)
|
||||
=> FileCasEvictions.Add(1, new KeyValuePair<string, object?>("sha256", sha256));
|
||||
|
||||
public static void RecordFileCasBytes(long bytes)
|
||||
=> FileCasBytes.Record(bytes);
|
||||
}
|
||||
Reference in New Issue
Block a user