Skip to content

Commit

Permalink
added removal of pull time info after 1 minute expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
imuni4fun committed Feb 14, 2024
1 parent 89adc0e commit d31d47d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/remoteimage/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func (p puller) Pull(ctx context.Context) (err error) {
elapsed := time.Since(startTime).Seconds()
metrics.ImagePullTimeHist.WithLabelValues(metrics.BoolToString(err != nil)).Observe(elapsed)
metrics.ImagePullTime.WithLabelValues(p.image.String(), metrics.BoolToString(err != nil)).Set(elapsed)
go func() {
//TODO: this is a hack to ensure data is cleared in a reasonable timeframe and does not build up.
// pushgateway may remove the need for this. https://prometheus.io/docs/practices/pushing/
time.Sleep(1 * time.Minute)
metrics.ImagePullTime.DeleteLabelValues(p.image.String(), metrics.BoolToString(err != nil))
}()
if err != nil {
metrics.OperationErrorsCount.WithLabelValues("pull").Inc()
}
Expand Down

0 comments on commit d31d47d

Please sign in to comment.