-
Notifications
You must be signed in to change notification settings - Fork 142
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
Prometheus select metric and stats queries. #956
Prometheus select metric and stats queries. #956
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.x #956 +/- ##
============================================
- Coverage 98.20% 95.68% -2.52%
- Complexity 3244 3325 +81
============================================
Files 313 334 +21
Lines 8119 9057 +938
Branches 532 672 +140
============================================
+ Hits 7973 8666 +693
- Misses 142 334 +192
- Partials 4 57 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
8f7f0fd
to
f39f5c4
Compare
688f640
to
716d188
Compare
5d13fea
to
4a79875
Compare
4a190d5
to
619a06b
Compare
Signed-off-by: Vamsi Manohar <[email protected]>
141a018
to
a43d827
Compare
e3e74a4
to
e86f7f5
Compare
Signed-off-by: Vamsi Manohar <[email protected]>
e86f7f5
to
97badc3
Compare
integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusCatalogCommandsIT.java
Show resolved
Hide resolved
|
||
@Getter | ||
@Setter | ||
public class PrometheusResponseFieldNames { |
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.
As I understand, this carries the metadata of Prometheus response, right? If so, because we represent dynamic Prometheus query as a Table
, I think this should be removed and the logic should be moved to PrometheusMetricTable.getFieldTypes()
?
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.
The above code is specifically to handle stats output field names which cannot be decided using getFieldTypes.
In the current state.
Logical project decides the field names in the response schema. It analyzes stat expressions and other expressions to come up with the field names in output response. In case of opensearch, the field name matches with the output response from the opensearch. But prometheus doesn't have any field names associated.
For eg:
source = x | stats avg(@value) by handler;
Opensearch produces output with avg(@value)
as field name for average.
Prometheus we need to map the output to the corresponding key.
Also for dynamic prometheus query, there is no easy way to figure out the output structure in prior without running the query.
So prometheusMetricTable.getFieldTypes() doesn't work in case of stats and dynamic queries. [Will try to address this after 2.4]
prometheus/src/main/java/org/opensearch/sql/prometheus/response/PrometheusResponse.java
Show resolved
Hide resolved
.../main/java/org/opensearch/sql/prometheus/request/system/PrometheusDescribeMetricRequest.java
Outdated
Show resolved
Hide resolved
prometheus/src/main/java/org/opensearch/sql/prometheus/request/PrometheusQueryRequest.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusCatalogCommandsIT.java
Show resolved
Hide resolved
.../main/java/org/opensearch/sql/prometheus/request/system/PrometheusDescribeMetricRequest.java
Outdated
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/ppl/PrometheusCatalogCommandsIT.java
Show resolved
Hide resolved
if (spanExpression.isEmpty()) { | ||
throw new RuntimeException( | ||
"Prometheus Catalog doesn't support aggregations without span expression"); | ||
} |
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.
If span is required, the exception should be thrown at logical -> physical stage, instead of here.
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.
Right, but that would cause issues with opensearch catalog,,,since it would be allowed for them. Don't want to distinguish catalogs in Analyzer component.
Can I do somewhere else?
Introduce validation of logical plan?
ea4a107
to
b030c32
Compare
Signed-off-by: Vamsi Manohar <[email protected]>
b030c32
to
e0d6be4
Compare
* Prometheus select metric and stats queries. Signed-off-by: reddyvam-amazon <[email protected]> (cherry picked from commit be4512e)
* Prometheus select metric and stats queries. Signed-off-by: vamsi-amazon <[email protected]>
Description
[Describe what this change achieves]
([Metrics] Bring back support for query_range table function support for prometheus connector. #1019)
Issues Resolved
#622
(ITs and doctests are followed)
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.