-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Changed Range Query to use startTimeMillis date field instead of startTime field #2980
Conversation
…cit shutdown Signed-off-by: Sreevani871 <sreevani@freshdesk.com>
…alises:true Signed-off-by: Sreevani871 <sreevani.karasala@freshworks.com>
Signed-off-by: Sreevani871 <sreevani.karasala@freshworks.com>
Signed-off-by: Sreevani871 <sreevani.karasala@freshworks.com>
Codecov Report
@@ Coverage Diff @@
## master #2980 +/- ##
=======================================
Coverage 95.95% 95.95%
=======================================
Files 223 223
Lines 9720 9726 +6
=======================================
+ Hits 9327 9333 +6
Misses 325 325
Partials 68 68
Continue to review full report at Codecov.
|
traceQuery := buildTraceByIDQuery(traceID) | ||
var query *elastic.BoolQuery | ||
if s.useReadWriteAliases { | ||
query = elastic.NewBoolQuery(). | ||
Must(startTimeRangeQuery). | ||
Must(traceQuery) | ||
} else { | ||
query = elastic.NewBoolQuery(). | ||
Must(traceQuery) | ||
} | ||
|
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.
We can simplify to:
query := elastic.NewBoolQuery().
Must(traceQuery)
if s.useReadWriteAliases {
startTimeRangeQuery := s.buildStartTimeQuery(startTime.Add(-time.Hour*24), endTime.Add(time.Hour*24))
query = query.Must(startTimeRangeQuery)
}
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.
Yes. Changed suggested way.
Signed-off-by: Sreevani871 <sreevani.karasala@freshworks.com>
Thanks @Sreevani871 ! |
This actually brought our average search time on Jaeger UI by 1/10. For search all the traces for a particular service/operation in last 2 hours - it used to take 30 secs on average [ We use ES backend and aliases ]. It is down to 3 seconds now. Awesome work! |
Which problem is this PR solving?
startTimeMillis
for findTraces API , when es-aliases are used #2923Short description of the changes
If
es.use-aliases
cofiguration field is set to true, jaeger-span-read alias is used in Elasticsearch which is applying to all indexes. Using time range query Elasticsearch will skip the unnecessary shards while searching. At present in the code, thestartTime
field is used in range query but it is stored astype: long
in Elasticsearch mapping. it's not skipping the unnecessary shards since Elasticsearch timeRange queries works with onlytype: date
field as discussed in the issue: #2923.Using startTimeMillisField irrespective of
es.use-aliases: true
will improve the performance of the ES query.Closed PR: #2978