Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
fix: Use ResetOnReport when generated report for Prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
Hervé CADROY committed Jan 16, 2019
1 parent a4c73a3 commit d975515
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -51,6 +51,14 @@ public static IEnumerable<Metric> ToPrometheusMetrics(this GaugeValueSource metr

public static IEnumerable<Metric> ToPrometheusMetrics(this CounterValueSource metric)
{
IEnumerable<Metric> items = null;

// when We Resting counter, we lost Items "Count"
if (metric.Value.Items?.Length > 0)
{
items = metric.Value.Items.Select(i => i.ToPrometheusMetric());
}

var result = new List<Metric>
{
new Metric
Expand All @@ -63,9 +71,9 @@ public static IEnumerable<Metric> ToPrometheusMetrics(this CounterValueSource me
}
};

if (metric.Value.Items?.Length > 0)
if (metric.Value.Items?.Length > 0 && items != null)
{
result.AddRange(metric.Value.Items.Select(i => i.ToPrometheusMetric()));
result.AddRange(items);
}

return result;
Expand Down

0 comments on commit d975515

Please sign in to comment.