Skip to content

Commit

Permalink
Merge pull request #359 from pyrra-dev/status-timestamp-roundup
Browse files Browse the repository at this point in the history
Don't round objective status query time
  • Loading branch information
metalmatze authored Jul 6, 2022
2 parents aee06b5 + a739a5f commit 3738a60
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,6 @@ type prometheusAPI interface {
QueryRange(ctx context.Context, query string, r prometheusv1.Range) (model.Value, prometheusv1.Warnings, error)
}

func RoundUp(t time.Time, d time.Duration) time.Time {
n := t.Round(d)
if n.Before(t) {
return n.Add(d)
}
return n
}

type promCache struct {
api prometheusAPI
cache *ristretto.Cache
Expand Down Expand Up @@ -460,7 +452,7 @@ func (o *ObjectivesServer) GetObjectiveStatus(ctx context.Context, expr, groupin
}
}

ts := RoundUp(time.Now().UTC(), 5*time.Minute)
ts := time.Now().UTC()

queryTotal := objective.QueryTotal(objective.Window)
level.Debug(o.logger).Log("msg", "sending query total", "query", queryTotal)
Expand Down

0 comments on commit 3738a60

Please sign in to comment.