-
Notifications
You must be signed in to change notification settings - Fork 141
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
Change query range response structure #1867
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"root": { | ||
"name": "QueryRangeFunctionTableScanOperator", | ||
"description": { | ||
"request": "query_range(prometheus_http_requests_total, 1689281439, 1689291439, 14)" | ||
}, | ||
"children": [] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,14 +94,12 @@ public PhysicalPlan visitIndexAggregation(PrometheusLogicalMetricAgg node, | |
public PhysicalPlan visitRelation(LogicalRelation node, | ||
PrometheusMetricScan context) { | ||
PrometheusMetricTable prometheusMetricTable = (PrometheusMetricTable) node.getTable(); | ||
if (prometheusMetricTable.getMetricName() != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just my feel that it's a little hard to follow why several There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In earlier implementation, query_range function implementation got coupled with normal PPL queries source = my_prometheus.proemtheus_http_requests_total implementation. This PR at least decouples few of the things. Need to refactor the existing implementation. I tried to refactor in this PR, the changes are becoming huge. Will cover them in another PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the new implementation. Visit Relation will always have metricName. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Please add TODO comment or put all refactor items in Github issue. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
String query = SeriesSelectionQueryBuilder.build(node.getRelationName(), null); | ||
context.getRequest().setPromQl(query); | ||
setTimeRangeParameters(null, context); | ||
context.getRequest() | ||
.setStep(StepParameterResolver.resolve(context.getRequest().getStartTime(), | ||
context.getRequest().getEndTime(), null)); | ||
} | ||
String query = SeriesSelectionQueryBuilder.build(node.getRelationName(), null); | ||
context.getRequest().setPromQl(query); | ||
setTimeRangeParameters(null, context); | ||
context.getRequest() | ||
.setStep(StepParameterResolver.resolve(context.getRequest().getStartTime(), | ||
context.getRequest().getEndTime(), null)); | ||
return context; | ||
} | ||
|
||
|
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.
I see
request
field is still in use in metric scan. So where we set it now?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.
It is set in https://github.com/opensearch-project/sql/blob/main/prometheus/src/main/java/org/opensearch/sql/prometheus/storage/implementor/PrometheusDefaultImplementor.java#L109 here
Implementation of query_range and ppl.prometheus_http_requests_total got coupled with weird logic. Need to refactor in another PR.
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.
query_range...we directly set the prometheusQueryRequest.
In case of
source = my_prometheus.prometheus_http_requests_total
we set these parameters in PrometheusDefaultImplementator class.