90
90
91
91
// SpanReader can query for and load traces from ElasticSearch
92
92
type SpanReader struct {
93
- ctx context.Context
94
93
client es.Client
95
94
logger * zap.Logger
96
95
// The age of the oldest service/operation we will look for. Because indices in ElasticSearch are by day,
@@ -119,9 +118,7 @@ type SpanReaderParams struct {
119
118
120
119
// NewSpanReader returns a new SpanReader with a metrics.
121
120
func NewSpanReader (p SpanReaderParams ) * SpanReader {
122
- ctx := context .Background ()
123
121
return & SpanReader {
124
- ctx : ctx ,
125
122
client : p .Client ,
126
123
logger : p .Logger ,
127
124
maxSpanAge : p .MaxSpanAge ,
@@ -337,7 +334,7 @@ func (s *SpanReader) multiRead(ctx context.Context, traceIDs []model.TraceID, st
337
334
}
338
335
// set traceIDs to empty
339
336
traceIDs = nil
340
- results , err := s .client .MultiSearch ().Add (searchRequests ... ).Index (indices ... ).Do (s . ctx )
337
+ results , err := s .client .MultiSearch ().Add (searchRequests ... ).Index (indices ... ).Do (ctx )
341
338
342
339
if err != nil {
343
340
logErrorToSpan (childSpan , err )
@@ -471,7 +468,6 @@ func (s *SpanReader) findTraceIDs(ctx context.Context, traceQuery *spanstore.Tra
471
468
// }
472
469
aggregation := s .buildTraceIDAggregation (traceQuery .NumTraces )
473
470
boolQuery := s .buildFindTraceIDsQuery (traceQuery )
474
-
475
471
jaegerIndices := s .timeRangeIndices (s .spanIndexPrefix , traceQuery .StartTimeMin , traceQuery .StartTimeMax )
476
472
477
473
searchService := s .client .Search (jaegerIndices ... ).
@@ -480,7 +476,7 @@ func (s *SpanReader) findTraceIDs(ctx context.Context, traceQuery *spanstore.Tra
480
476
IgnoreUnavailable (true ).
481
477
Query (boolQuery )
482
478
483
- searchResult , err := searchService .Do (s . ctx )
479
+ searchResult , err := searchService .Do (ctx )
484
480
if err != nil {
485
481
return nil , errors .Wrap (err , "Search service failed" )
486
482
}
0 commit comments