Skip to content

Fixed query start/end timestamp rounding #2990

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

Merged

Conversation

pracucci
Copy link
Contributor

@pracucci pracucci commented Aug 6, 2020

What this PR does:
The good @juliusv reported we're not rounding query start/end timestamps like Prometheus. This PR fixes it, specifically introduces the change done in Prometheus almost 3y ago prometheus/prometheus#4941.

Which issue(s) this PR fixes:
Fixes #2932

Checklist

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

@juliusv
Copy link
Contributor

juliusv commented Aug 6, 2020

👍

@pracucci pracucci requested a review from pstibrany August 7, 2020 13:34
input: "1543578564.705",
result: time.Unix(1543578564, 705*1e6),
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What about `input: "2015-06-03T13:21:58.56789Z" ... should that be rounded on milliseconds precision?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied the exact implementation and tests of Prometheus. Should we keep it 1-1 with Prometheus or change it? I'm open to discuss it.

Copy link
Contributor

Choose a reason for hiding this comment

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

No strong opinion on milliseconds rounding... We can keep it as-is to be consistent with Prometheus, and think about it when (if) someone hits that. Then we can clarify at both places (depending on what Prometheus decides)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a test. I believe we should just use the Prometheus implementation as reference implementation (we want to be 100% compatible with Prometheus) and thus I've written the expected value with the current Prometheus rounding.

Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
@pracucci pracucci force-pushed the fix-query-start-end-time-parsing branch from ffe6e4c to 572b261 Compare August 10, 2020 10:36
@pracucci pracucci merged commit 5e5b96d into cortexproject:master Aug 10, 2020
@pracucci pracucci deleted the fix-query-start-end-time-parsing branch August 10, 2020 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All result timestamps off by 1ms (without alignment turned on)
3 participants