-
Notifications
You must be signed in to change notification settings - Fork 313
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: export promql service in server #924
Conversation
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
I'm also wondering if it's beneficial to provide other ways to perform promql queries, like via SDK or special SQL. |
Codecov Report
@@ Coverage Diff @@
## develop #924 +/- ##
===========================================
- Coverage 86.04% 85.74% -0.30%
===========================================
Files 439 441 +2
Lines 58653 58941 +288
===========================================
+ Hits 50469 50541 +72
- Misses 8184 8400 +216
Flags with carried forward coverage won't be shown. Click here to find out 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>
What about |
Of course, it's better to provide other ways to perform PromQL queries, especially SQL and our gRPC SDK. |
Seems promql is only executed via http? In that case, I suggest not using By the way, I think we can get rid of |
After discussing with @killme2008, we think it's better to provide promql query through two ways:
Implement prometheus' official API can make GreptimeDB a drop-in replacement for Prometheus. Existing systems like grafana only need to change the server address/port to migrate. While |
Looking great 👍
Consider implementing the prometheus' HTTP API (described in #924 (comment)), is it still necessary to add |
@waynexia If we are to make our db as a drop in replacement for prometheus, a dedicated server(then a dedicated port) is better. So that prometheus queries do not mix-up with other protocols API pathes. |
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
I'd file two follow-up PRs for (1) rename |
There're conflicts. Also would you kind enough to create an issue and assign to me, that our gRPC SDK needs to support promql? thx |
Opened #936 for this |
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
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
@waynexia Test failure |
Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
* chore: some tiny typo/style fix Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * feat: add promql server Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * works for mocked query Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * clean up Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * integration test case Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * resolve CR comments Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * expose promql api to our http server Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * resolve CR comments Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * adjust router structure Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
I hereby agree to the terms of the GreptimeDB CLA
What's changed and what's your intention?
Add a promql service to serve PromQL queries. Currently only
query
andrange_query
are defined, and onlyrange_query
returns mock results.This PR also includes some minor changes in a separated commit 26d0918
For the name of this new service, I would prefer to rename it to
prometheus
as it's a subset of prometheus HTTP API, and can be extended to implement other methods that are not included in this PR. So I propose to rename the currentprometheus
service toprom_store
, which implements Prometheus' remote storage APIs, and rename the new service frompromql
toprometheus
. What do you think about this @killme2008The code structure may need some adjustments. Specificly for
PromqlHandler
andPromqlServer
. Do I need to put them under the HTTP server or other places? cc @MichaelScofield PTAL at this and looking forward to hearing your advice.An important missing part of this functionality is the codec of query results. We are using table model all around, it looks impossible to return multi-value columns in prometheus' format. Maybe we need to introduce some hack like built-in tag
__value__
. And beside this, converting should also consider the semantic type in the result's schema. This needs to change the planner and maybe the executor, so I plan to implement codec in the follow-up PR(s).I'm also wondering if it's beneficial to provide other ways to perform promql queries, like via SDK or special SQL.
Things left to do in this PR:
PromqlServer
into serval sub-modules.test-integration
case for this new service.Some screenshots
Checklist
Refer to a related PR or issue link (optional)
#596