Skip to content

Commit

Permalink
fix: Switch collector_collect_loop_duration_ms metric to be a histo…
Browse files Browse the repository at this point in the history
…gram (#1381)

## Which problem is this PR solving?

- Recording the value as a guage meant that a lot of values were missed
as the older values got overwritten by newer values. This meant the
largest value in the interval may not get exported.

## Short description of the changes

- Switch `collector_collect_loop_duration_ms` from gauge to histogram to
make sure max values are captured.
  • Loading branch information
TylerHelmuth authored Oct 11, 2024
1 parent 27d8543 commit 1d6e2e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion collect/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ func (i *InMemCollector) collect() {
}
}

i.Metrics.Gauge("collector_collect_loop_duration_ms", float64(time.Now().Sub(startTime).Milliseconds()))
i.Metrics.Histogram("collector_collect_loop_duration_ms", float64(time.Now().Sub(startTime).Milliseconds()))
}
}

Expand Down

0 comments on commit 1d6e2e5

Please sign in to comment.