mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-14 19:14:15 +01:00
add statistics
This commit is contained in:
parent
213fea5d41
commit
203fa1b194
4 changed files with 21 additions and 3 deletions
|
|
@ -25,6 +25,22 @@ public class MareMetrics
|
|||
|
||||
private readonly Dictionary<string, Gauge> _gauges = new(StringComparer.Ordinal);
|
||||
|
||||
public void IncGaugeWithLabels(string gaugeName, double value = 1.0, params string[] labels)
|
||||
{
|
||||
if (_gauges.TryGetValue(gaugeName, out Gauge gauge))
|
||||
{
|
||||
gauge.WithLabels(labels).Inc(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void DecGaugeWithLabels(string gaugeName, double value = 1.0, params string[] labels)
|
||||
{
|
||||
if (_gauges.TryGetValue(gaugeName, out Gauge gauge))
|
||||
{
|
||||
gauge.WithLabels(labels).Dec(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGaugeTo(string gaugeName, double value)
|
||||
{
|
||||
if (_gauges.TryGetValue(gaugeName, out Gauge gauge))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue