set user agent correctly
add statistics fix bug
This commit is contained in:
@@ -17,7 +17,10 @@ public class MareMetrics
|
||||
foreach (var gauge in gaugesToServe)
|
||||
{
|
||||
logger.LogInformation($"Creating Metric for Counter {gauge}");
|
||||
gauges.Add(gauge, Prometheus.Metrics.CreateGauge(gauge, gauge));
|
||||
if (!string.Equals(gauge, MetricsAPI.GaugeConnections, StringComparison.OrdinalIgnoreCase))
|
||||
gauges.Add(gauge, Prometheus.Metrics.CreateGauge(gauge, gauge));
|
||||
else
|
||||
gauges.Add(gauge, Prometheus.Metrics.CreateGauge(gauge, gauge, new[] { "continent" }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +28,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.ContainsKey(gaugeName))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public class MetricsAPI
|
||||
{
|
||||
public const string CounterInitializedConnections = "mare_initialized_connections";
|
||||
public const string GaugeConnections = "mare_unauthorized_connections";
|
||||
public const string GaugeConnections = "mare_connections";
|
||||
public const string GaugeAuthorizedConnections = "mare_authorized_connections";
|
||||
public const string GaugeAvailableWorkerThreads = "mare_available_threadpool";
|
||||
public const string GaugeAvailableIOWorkerThreads = "mare_available_threadpool_io";
|
||||
|
||||
Reference in New Issue
Block a user