-
Notifications
You must be signed in to change notification settings - Fork 512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix and test label query optional time param parsing for additional queue dimensions #6969
fix and test label query optional time param parsing for additional queue dimensions #6969
Conversation
@@ -297,12 +297,12 @@ func DecodeInstantQueryTimeParams(r *http.Request) (int64, error) { | |||
} | |||
|
|||
func DecodeLabelsQueryTimeParams(r *http.Request) (start, end int64, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to also update DecodeRangeQueryTimeParams
and DecodeInstantQueryTimeParams
to use the new util as well (among a bunch of other updates to this codec package) - however I am keeping this scope down for this PR since DecodeLabelsQueryTimeParams
is only used for this new functionality so far, unlike the other two functions.
start: now.Add(-adapter.limits.QueryIngestersWithin("")).Add(30 * time.Minute), | ||
end: now, | ||
start: now.Add(-adapter.limits.QueryIngestersWithin("")).Add(29 * time.Minute), | ||
end: now.Add(-adapter.limits.QueryIngestersWithin("")).Add(31 * time.Minute), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mistake from previous PR
@@ -35,6 +36,19 @@ func FormatTimeModel(t model.Time) string { | |||
return TimeFromMillis(int64(t)).String() | |||
} | |||
|
|||
// ParseTimeParam parses the desired time param from a Prometheus http request into an int64, milliseconds since epoch. | |||
func ParseTimeParam(r *http.Request, paramName string, defaultValue int64) (int64, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like ParseTime
below, this just lifts a private prometheus util out of https://github.com/grafana/mimir/blob/41af1393d6e2b799c701448f7c54c62c15075916/vendor/github.com/prometheus/prometheus/web/api/v1/api.go
and updates it to use int64 unix milliseconds instead of time.Time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What this PR does
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.