Skip to content

Enable @ modifier with result cache handling #3744

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
merged 6 commits into from
Feb 2, 2021

Conversation

codesome
Copy link
Contributor

@codesome codesome commented Jan 26, 2021

What this PR does:

Enables the newly added @ modifier in PromQL with cache handling for it.

If the time in @ is > query end time, then we don't cache the result. If @ time is <= end, then we cache, since even if the start and end were actually in the future we would end up caching the result anyway.

Checklist

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

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Copy link
Contributor

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

👍

@pstibrany
Copy link
Contributor

Should we keep @ support protected by flag? Or is it enabled in Prometheus by default?

@codesome
Copy link
Contributor Author

Should we keep @ support protected by flag? Or is it enabled in Prometheus by default?

It is disabled by default in Prometheus because it has no in-built caching and so that users of PromQL can enable when they have fixed the caching to use this modifier. Since we handle the caching inside Cortex itself, I don't think we need to have a flag for that and just enable it by default.

Ganesh Vernekar added 2 commits January 26, 2021 13:53
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@codesome
Copy link
Contributor Author

After some offline discussions, I have added a flag for @ modifier.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@codesome codesome marked this pull request as draft January 27, 2021 15:31
@codesome codesome marked this pull request as ready for review January 27, 2021 15:31
Ganesh Vernekar added 2 commits January 31, 2021 18:34
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@gouthamve gouthamve merged commit 174a2bf into cortexproject:master Feb 2, 2021
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Good job! I left a nit post-merge comment.

}
expr, err := parser.ParseExpr(query)
if err != nil {
// We are being pessimistic in such cases.
Copy link
Contributor

Choose a reason for hiding this comment

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

A warning log may be useful here. WDYT?

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 will open another PR for the warning.

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.

4 participants