-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Add time range bucketing attribute to APM took time latency metrics #135549
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
base: main
Are you sure you want to change the base?
Changes from 9 commits
fad3c42
e81fb6c
6470960
1aed53d
6eb53a3
3967f72
3eb28fa
d9fdc5b
cc195d4
b5f144d
d81c985
532eb96
0684e86
ff41cb0
f985361
2ba5023
bcffd12
d663723
5eaf6db
233db24
ba23911
53a80d0
54a8a4f
97cb335
3f47f9a
6948a16
e28898f
edffb03
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,5 @@ | ||
pr: 135549 | ||
summary: Add time range bucketing attribute to APM took time latency metrics | ||
area: Search | ||
type: enhancement | ||
issues: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,8 +300,13 @@ public String getWriteableName() { | |
protected Query doToQuery(SearchExecutionContext context) throws IOException { | ||
BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder(); | ||
addBooleanClauses(context, booleanQueryBuilder, mustClauses, BooleanClause.Occur.MUST); | ||
addBooleanClauses(context, booleanQueryBuilder, mustNotClauses, BooleanClause.Occur.MUST_NOT); | ||
addBooleanClauses(context, booleanQueryBuilder, shouldClauses, BooleanClause.Occur.SHOULD); | ||
try { | ||
context.setTrackRangeTimestampFrom(false); | ||
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. should we document why we disable this tracking here? maybe secondary, but if we have only one should clause, we want to track the range? 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 can add a comment, yes we could have a special case for bool with a single should. 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. this reminds me of the current discrepancy between the boolean attribute that signals whether there is a filter on timestamp, and the range bucket. I meant to ask you what you think about this. If a shard has all documents within the range, it is in fact not a range query when it comes to the lucene level, but rather a match_all. I thought that we'd want to track this distinction. At the coord level, we will always extract the original range before query rewrite and set to flag to true. 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. Looking further, I don't think I will add a special case for bool with a single should clause. I already don't like how intrusive the metrics tracking is in the actual code that does stuff. I am way of adding more logic to control when to report on metrics, intermingled with the actual code that rewrites and executes queries. I think that having a time range as a single should clause it also quite an edge case. If needed we can always optimize it later. 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. Sounds good, thanks for looking into this |
||
addBooleanClauses(context, booleanQueryBuilder, mustNotClauses, BooleanClause.Occur.MUST_NOT); | ||
addBooleanClauses(context, booleanQueryBuilder, shouldClauses, BooleanClause.Occur.SHOULD); | ||
} finally { | ||
context.setTrackRangeTimestampFrom(true); | ||
} | ||
addBooleanClauses(context, booleanQueryBuilder, filterClauses, BooleanClause.Occur.FILTER); | ||
BooleanQuery booleanQuery = booleanQueryBuilder.build(); | ||
if (booleanQuery.clauses().isEmpty()) { | ||
|
@@ -348,9 +353,21 @@ protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) throws | |
return new MatchAllQueryBuilder().boost(boost()).queryName(queryName()); | ||
} | ||
changed |= rewriteClauses(queryRewriteContext, mustClauses, newBuilder::must); | ||
changed |= rewriteClauses(queryRewriteContext, mustNotClauses, newBuilder::mustNot); | ||
|
||
try { | ||
queryRewriteContext.setTrackRangeTimestampFrom(false); | ||
changed |= rewriteClauses(queryRewriteContext, mustNotClauses, newBuilder::mustNot); | ||
} finally { | ||
queryRewriteContext.setTrackRangeTimestampFrom(true); | ||
} | ||
changed |= rewriteClauses(queryRewriteContext, filterClauses, newBuilder::filter); | ||
changed |= rewriteClauses(queryRewriteContext, shouldClauses, newBuilder::should); | ||
try { | ||
queryRewriteContext.setTrackRangeTimestampFrom(false); | ||
changed |= rewriteClauses(queryRewriteContext, shouldClauses, newBuilder::should); | ||
} finally { | ||
queryRewriteContext.setTrackRangeTimestampFrom(true); | ||
} | ||
|
||
// early termination when must clause is empty and optional clauses is returning MatchNoneQueryBuilder | ||
if (mustClauses.size() == 0 | ||
&& filterClauses.size() == 0 | ||
|
Uh oh!
There was an error while loading. Please reload this page.