Add direct-query-core module for prometheus integration#3440
Conversation
| @Override | ||
| public ExecuteDirectQueryResponse executeDirectQuery(ExecuteDirectQueryRequest request) { | ||
| // TODO: Replace with the data source query id. | ||
| String queryId = UUID.randomUUID().toString(); |
| try { | ||
| return handler.executeQuery(client, request); | ||
| } catch (IOException e) { | ||
| return "{\"error\": \"Error executing query: " + e.getMessage() + "\"}"; |
There was a problem hiding this comment.
if prometheus returns an error, should the SQL request fail with non-200 response?
| Response response = this.okHttpClient.newCall(request).execute(); | ||
|
|
||
| logger.info("Received Prometheus response for instant query: code={}", response); | ||
| // Return the full response object, not just the data field |
There was a problem hiding this comment.
what does the comment mean?
| package org.opensearch.sql.prometheus.exceptions; | ||
| package org.opensearch.sql.prometheus.exception; | ||
|
|
||
| import org.opensearch.sql.datasources.exceptions.DataSourceClientException; |
There was a problem hiding this comment.
this should be package org.opensearch.sql.datasource.client.exceptions.DataSourceClientException;? i think we should remove one of the two DataSourceClientException
any reason we need the datasource package under direct-query-core? or can we move it to datasource module?
Co-authored-by: Megha Goyal <goyamegh@amazon.com> Signed-off-by: Joshua Li <joshuali925@gmail.com>
ac6059f to
a64eefe
Compare
|
This PR is stalled because it has been open for 30 days with no activity. |
|
Hi @joshuali925 , do we still need this? |
|
we do, but currently no bandwidth |
@lezzago and I will take over this and take it further. Thanks. |
|
This PR is stalled because it has been open for 30 days with no activity. |
| // Optional fields | ||
| private Integer maxResults; // Optional: limit for Prometheus, maxDataPoints for CW | ||
| private Integer timeout; // Optional: number of seconds | ||
| private DataSourceOptions options; // Optional: Source specific arguments |
There was a problem hiding this comment.
Would we want a separate queryOptions or is the idea to have this contain query options as those are in a way specific to a datasource.
There was a problem hiding this comment.
can't remember the details, will leave it to query API owner @goyamegh
currently this is the only usage
does look like query options
| public class ExecuteDirectQueryResponse { | ||
| private String queryId; | ||
| private String result; | ||
| private String sessionId; |
There was a problem hiding this comment.
Is this needed if we have the queryId? What benefit is there to add another tracker if we can just use queryId everywhere instead.
There was a problem hiding this comment.
i remember session id is for EMR job control, and different queries might reuse the same EMR job. I might be wrong but i agree direct (sync) query shouldn't have session concept.
will leave it to query API owner @goyamegh
…-query-core Signed-off-by: Joshua Li <joshuali925@gmail.com>
0ee85a3
into
opensearch-project:feature/direct-query-prometheus
Description
This PR adds direct-query-core module to SQL. It implements the following changes
ExecuteDirectQueryandGetDirectQueryResourcesactionsprometheusThis PR does not expose the actions in SQL plugin at runtime. The follow up #3441 for
direct-querymodule will add the rest and transport actions to SQLQuery API owner: @goyamegh
Resources API owner: @joshuali925
It is currently in draft since some tests are not fixed yet
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
--signoff.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.