feat: adds support for building converter for query service response builder from PromQL response#113
Conversation
Codecov Report
@@ Coverage Diff @@
## main #113 +/- ##
============================================
+ Coverage 78.60% 78.92% +0.32%
- Complexity 508 524 +16
============================================
Files 50 51 +1
Lines 2000 2064 +64
Branches 216 221 +5
============================================
+ Hits 1572 1629 +57
- Misses 333 337 +4
- Partials 95 98 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@rish691 added the test. It returns the result both for instant query and range query. It is also able to merge multiple metrics. However, need to optimize, but you can work on top of it. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| * */ | ||
| static List<Row> buildResponse( | ||
| Map<Request, PromQLMetricResponse> promQLMetricResponseMap, | ||
| Map<String, String> columnNameToAttributeMap, |
There was a problem hiding this comment.
nit: can we rename the param names?
Map<String, String> logicalAttributeNameToMetricAttributeMap,
Map<String, String> logicalAttributeNameToMetricQueryMap,
List<String> columnSelectionSet,
There was a problem hiding this comment.
done. All remove some of the unused code.
This comment has been minimized.
This comment has been minimized.
|
|
||
| kafkaZk = | ||
| new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka")) | ||
| new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.0.0")) |
There was a problem hiding this comment.
nit: lets add a todo here to use latest version again

This PR is for handling tickets - hypertrace/hypertrace#326
This PR converts the PormQL response structure of instant query and range query to Query
Ref:
Instant Query Response: https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries
Range Query Response: https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries
QS Response: https://github.com/hypertrace/query-service/blob/main/query-service-api/src/main/proto/response.proto#L22
In this PR, Prepare the Row structure of Query Service Response.
As for a single QS request, it can result in multiple PromQL metric query requests. However, the response of each PromQL query request only differs on Metric name and value, the rest of the argument for attributes are the same.
So, the approach here is that we prepare the rest of the attributes (for QS Row) from one of the PromQL responses, and for metric values columns, we create columns from the individual response.
As an example:
Corresponding PromQL queries:
So, for the above example, while preparing row,
backend_idinformation is collected form one of the responsebackend_idwill be collected from the individual responses.