Skip to content

feat: handle PromQL HTTP API parameters#985

Merged
sunng87 merged 14 commits intoGreptimeTeam:developfrom
waynexia:prom-api-param
Feb 15, 2023
Merged

feat: handle PromQL HTTP API parameters#985
sunng87 merged 14 commits intoGreptimeTeam:developfrom
waynexia:prom-api-param

Conversation

@waynexia
Copy link
Copy Markdown
Member

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Add start, end and step's parser part to promql's EvalStmt. And process them in the exposed HTTP API.

Notice that the lookback in promql is set in something like query context. We may expose it in the HTTP API in the future, but for this PR it's ignored.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2023

Codecov Report

Merging #985 (be56dc8) into develop (e17d564) will decrease coverage by 0.04%.
The diff coverage is 93.51%.

@@             Coverage Diff             @@
##           develop     #985      +/-   ##
===========================================
- Coverage    86.01%   85.97%   -0.04%     
===========================================
  Files          436      436              
  Lines        62930    63084     +154     
===========================================
+ Hits         54128    54236     +108     
- Misses        8802     8848      +46     
Flag Coverage Δ
rust 85.97% <93.51%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/frontend/src/instance/distributed.rs 87.67% <0.00%> (ø)
src/frontend/src/instance/standalone.rs 61.70% <0.00%> (ø)
src/servers/src/http.rs 78.01% <0.00%> (ø)
src/servers/src/query_handler/sql.rs 58.92% <42.85%> (+22.39%) ⬆️
src/frontend/src/instance.rs 80.07% <50.00%> (+0.56%) ⬆️
src/datanode/src/instance/sql.rs 80.85% <95.23%> (+1.15%) ⬆️
src/query/src/parser.rs 97.76% <100.00%> (+4.11%) ⬆️
src/servers/src/http/handler.rs 72.28% <100.00%> (+22.97%) ⬆️
src/servers/src/promql.rs 50.71% <100.00%> (+2.20%) ⬆️
src/object-store/src/test_util.rs 0.00% <0.00%> (-100.00%) ⬇️
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Comment thread src/query/src/error.rs Outdated
Comment thread src/query/src/error.rs Outdated
Comment thread src/query/src/parser.rs Outdated
Comment thread src/query/src/parser.rs Outdated
Comment thread src/common/error/src/ext.rs Outdated
Comment thread src/servers/src/http/handler.rs Outdated
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Comment thread src/query/src/parser.rs Outdated
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Copy link
Copy Markdown
Member

@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.

LGTM

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
@waynexia waynexia requested a review from sunng87 February 15, 2023 08:07
@waynexia waynexia added this to the v0.1 milestone Feb 15, 2023
@sunng87 sunng87 merged commit dfe7bfb into GreptimeTeam:develop Feb 15, 2023
@waynexia waynexia deleted the prom-api-param branch February 15, 2023 09:20
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: impl EvalStmt parser

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix compile errors

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* update test result

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add integration test

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix clippy

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* resolve CR comments

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* impl From<PromqlQuery> for PromQuery

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* move format into with_context

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* update test result

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* shorthand compound error

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* use rfc3339 error to report float parsing error

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* remove CompoundError

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
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.

4 participants