Skip to content
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

Conversation

francoposa
Copy link
Member

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@francoposa francoposa requested a review from a team as a code owner December 19, 2023 21:18
@@ -297,12 +297,12 @@ func DecodeInstantQueryTimeParams(r *http.Request) (int64, error) {
}

func DecodeLabelsQueryTimeParams(r *http.Request) (start, end int64, err error) {
Copy link
Member Author

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),
Copy link
Member Author

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) {
Copy link
Member Author

@francoposa francoposa Dec 19, 2023

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

Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@francoposa francoposa merged commit bcb5c34 into main Dec 19, 2023
28 checks passed
@francoposa francoposa deleted the francoposa/fix-label-query-time-parsing-for-additional-queue-dimensions branch December 19, 2023 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants