-
Notifications
You must be signed in to change notification settings - Fork 549
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
unify time parsing logic in prometheus codec; clarify labels-series compatibility #10117
unify time parsing logic in prometheus codec; clarify labels-series compatibility #10117
Conversation
a8aee76
to
4897225
Compare
related PR: Early Request Validation in Query Frontend #10093 |
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.
thankss! LGTM
@@ -531,10 +536,10 @@ func DecodeRangeQueryTimeParams(reqValues *url.Values) (start, end, step int64, | |||
} | |||
|
|||
func instantTimeParamNow() int64 { | |||
return time.Now().UnixMilli() | |||
return time.Now().UTC().UnixMilli() |
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.
is the UTC()
necessary? I thought UnixMilli
is only defined in UTC
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.
Ah yeah true. I am just in the habit of making sure anything with time gets UTC-ed
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, no concerns from my end
35830da
to
a880464
Compare
…ompatibility (grafana#10117) * unify time parsing logic in prometheus codec; clarify labels-series req
What this PR does
With an eye towards early request validation, I set out to implement endpoint param parsing for the series endpoints.
To start, this unifies time parsing logic using the
promTimeParamDecodable
type.This could be reviewed on its own but I got a bit carried away.
I also chased down that we have already implemented this for the series endpoint, it was just unclear from the interface because everything is called a "labels request".
I have renamed types to reflect the fact that they are for both labels and series, as well as added comments on
DecodeLabelsSeriesQueryTimeParams
about how the Prometheus HTTP API spec makes it appear as though the labels and series start/end processing is incompatible, but it actually is compatible per the implementation.Renaming is a bit disruptive but I prefer it to just leaving misleading naming. In any case, if we were to pick one name to cover "Labels and Series" requests, the more general and accurate name would be Series.
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.