Skip to content

Commit

Permalink
Represent SDM Counters as Gauges In Prometheus Exposition Format (#4101)
Browse files Browse the repository at this point in the history
Co-authored-by: kkeirstead <[email protected]>
  • Loading branch information
github-actions[bot] and kkeirstead authored Mar 30, 2023
1 parent 5a997db commit a681b6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ private static string GetMetricType(EventType eventType)
{
switch (eventType)
{
// In Prometheus, rates are treated as gauges due to their non-monotonic nature
case EventType.Rate:
return "counter";
case EventType.Gauge:
return "gauge";
case EventType.Histogram:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public async Task CounterFormat_Test()

Assert.Equal(3, lines.Count);
Assert.Equal($"# HELP {metricName}{payload.Unit} {payload.DisplayName}", lines[0]);
Assert.Equal($"# TYPE {metricName} counter", lines[1]);
Assert.Equal($"# TYPE {metricName} gauge", lines[1]);
Assert.Equal($"{metricName} {payload.Value} {new DateTimeOffset(payload.Timestamp).ToUnixTimeMilliseconds()}", lines[2]);
}

Expand Down

0 comments on commit a681b6c

Please sign in to comment.