Add streaming dimension to query categorization metrics#551
Add streaming dimension to query categorization metrics#551ansjcy merged 3 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
|
@rishabhmaurya @bowenlan-amzn @ansjcy for review |
| userPrincipalContext, | ||
| null | ||
| ); | ||
| record.setStreaming(searchRequestContext.isStreamingRequest()); |
There was a problem hiding this comment.
Do you need this stream flag in top queries record? Or just metrics?
If you need it in top queries, you need to do more than this and set / get, you need to change the serialization, copy constructor, equals, hascode etc.
There was a problem hiding this comment.
For the time being we just need it in the metrics, we might want to analyze top queries later but that is not part of the plan right now
| */ | ||
| public void incrementAggCounter(double value, Tags tags, Map<MetricType, Measurement> measurements) { | ||
| public void incrementAggCounter(double value, Tags tags, Map<MetricType, Measurement> measurements, boolean isStreaming) { | ||
| tags.addTag(IS_STREAMING_TAG, String.valueOf(isStreaming)); |
There was a problem hiding this comment.
The is_streaming tag is only added to incrementAggCounter, but NOT to incrementCounter (query type counter) or incrementSortCounter. If a streaming request has a query clause and a sort clause but no aggregation, no streaming tag will be emitted for those metrics.
Is this intentional?
There was a problem hiding this comment.
Yes, this is intentional. For the time being, only aggregation queries(specifically terms agg) will be streaming. At some point in the future we might support regular queries. We have logic in core where if there is no agg, then by default we do not choose the streaming path.
|
Looks like the test is failing with Do we need to merge the core change before this PR? |
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> (cherry picked from commit 2dd3aba) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This PR works on top of opensearch-project/OpenSearch#20530. We now pass down a streaming flag for a request into the search request context from OpenSearch. We can then read that flag while categorizing a query and then tag that request with streaming. Right now streaming only works for aggregations so updated the aggregations tag
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
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.