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

feat: support PromQL operations over the same metric #3124

Merged
merged 3 commits into from
Jan 11, 2024

Conversation

waynexia
Copy link
Member

@waynexia waynexia commented Jan 9, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This patch fixes a problem that when join on the same table(metric), operations will lead to wrong result due to qualifier ambiguity. E.g.: (sum by(host) (irate(host_cpu_seconds_total{mode!="idle"}[1m0s])) / sum by (host)((irate(host_cpu_seconds_total[1m0s])))) * 100; which calculate the CPU utilies. Before this change it will always return 1

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Refer to a related PR or issue link (optional)

Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Jan 9, 2024
@waynexia waynexia requested a review from nicecui January 9, 2024 11:00
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a0a31c8) 85.61% compared to head (77b748f) 85.00%.
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3124      +/-   ##
==========================================
- Coverage   85.61%   85.00%   -0.61%     
==========================================
  Files         815      822       +7     
  Lines      133411   134415    +1004     
==========================================
+ Hits       114222   114262      +40     
- Misses      19189    20153     +964     

@waynexia waynexia enabled auto-merge January 9, 2024 11:29
Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

Almostly LGTM

src/promql/src/planner.rs Outdated Show resolved Hide resolved
@killme2008
Copy link
Contributor

@yuanbohan PTAL

Signed-off-by: Ruihang Xia <[email protected]>
@waynexia waynexia added this pull request to the merge queue Jan 11, 2024
Merged via the queue into GreptimeTeam:main with commit 0882da4 Jan 11, 2024
15 checks passed
@waynexia waynexia deleted the alias-prom-join branch January 11, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants