forked from man-group/dapr-sidekick-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrometheusModel.cs
50 lines (40 loc) · 1.16 KB
/
PrometheusModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections.Generic;
namespace Man.Dapr.Sidekick.AspNetCore.Metrics
{
public class PrometheusModel
{
public class Metric
{
public Metric(string name)
{
Name = name;
MetricLines = new List<string>();
}
public string Name { get; }
public string HelpLine { get; set; }
public string TypeLine { get; set; }
public List<string> MetricLines { get; }
public override string ToString() => Name;
}
public PrometheusModel()
{
Metrics = new Dictionary<string, Metric>();
Unknown = new List<string>();
}
public Dictionary<string, Metric> Metrics { get; }
public List<string> Unknown { get; }
internal Metric GetOrAddMetric(string name)
{
if (Metrics.ContainsKey(name))
{
return Metrics[name];
}
else
{
var metric = new Metric(name);
Metrics.Add(name, metric);
return metric;
}
}
}
}