Skip to content

Commit

Permalink
Replace gauge value instead of summing
Browse files Browse the repository at this point in the history
  • Loading branch information
tsotnikov committed Nov 26, 2024
1 parent 1d246ea commit cd6408b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Prometheus Aggregation Gateway is a push gateway that aggregates metrics for Pro

* Counters where all labels match are added up.
* Histograms are added up; if bucket boundaries are mismatched then the result has the union of all buckets and counts are given to the lowest bucket that fits.
* Gauges are also added up (but this may not make any sense)
* Gauges are replaced
* Summaries are treated as a pair of counters (quantile information is discarded if present).

## How to use
Expand Down
5 changes: 1 addition & 4 deletions metrics/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,10 @@ func mergeMetric(ty dto.MetricType, a, b *dto.Metric) *dto.Metric {
}

case dto.MetricType_GAUGE:
// No very meaningful way for us to merge gauges. We'll sum them
// and clear out any gauges on scrape, as a best approximation, but
// this relies on client pushing with the same interval as we scrape.
return &dto.Metric{
Label: a.Label,
Gauge: &dto.Gauge{
Value: float64ptr(*a.Gauge.Value + *b.Gauge.Value),
Value: float64ptr(*b.Gauge.Value),
},
}

Expand Down

0 comments on commit cd6408b

Please sign in to comment.