Skip to content

Commit

Permalink
Fix todos
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
Yuri Shkuro committed Sep 4, 2018
1 parent bae8e25 commit ad2344b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugin/storage/cassandra/spanstore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ func (s *SpanReader) readTraceInSpan(ctx context.Context, traceID dbmodel.TraceI
}
span, err := dbmodel.ToDomain(&dbSpan)
if err != nil {
//do we consider conversion failure to cause such metrics to be emitted? for now i'm assuming yes.
s.metrics.readTraces.Emit(err, time.Since(start))
return nil, err
}
Expand Down Expand Up @@ -292,6 +291,8 @@ func (s *SpanReader) queryByTagsAndLogs(ctx context.Context, tq *spanstore.Trace

results := make([]dbmodel.UniqueTraceIDs, 0, len(tq.Tags))
for k, v := range tq.Tags {
childSpan := opentracing.StartSpan("queryByTag")
childSpan.LogFields(otlog.String("tag.key", k), otlog.String("tag.value", v))
query := s.session.Query(
queryByTag,
tq.ServiceName,
Expand All @@ -301,8 +302,8 @@ func (s *SpanReader) queryByTagsAndLogs(ctx context.Context, tq *spanstore.Trace
model.TimeAsEpochMicroseconds(tq.StartTimeMax),
tq.NumTraces*limitMultiple,
).PageSize(0)
// TODO should have span per iteration
t, err := s.executeQuery(span, query, s.metrics.queryTagIndex)
t, err := s.executeQuery(childSpan, query, s.metrics.queryTagIndex)
childSpan.Finish()
if err != nil {
return nil, err
}
Expand All @@ -329,6 +330,8 @@ func (s *SpanReader) queryByDuration(ctx context.Context, traceQuery *spanstore.
endTimeByHour := traceQuery.StartTimeMax.Round(durationBucketSize)

for timeBucket := endTimeByHour; timeBucket.After(startTimeByHour) || timeBucket.Equal(startTimeByHour); timeBucket = timeBucket.Add(-1 * durationBucketSize) {
childSpan := opentracing.StartSpan("queryForTimeBucket")
childSpan.LogFields(otlog.String("timeBucket", timeBucket.String()))
query := s.session.Query(
queryByDuration,
timeBucket,
Expand All @@ -337,8 +340,8 @@ func (s *SpanReader) queryByDuration(ctx context.Context, traceQuery *spanstore.
minDurationMicros,
maxDurationMicros,
traceQuery.NumTraces*limitMultiple)
// TODO should have span for each iteration
t, err := s.executeQuery(span, query, s.metrics.queryDurationIndex)
t, err := s.executeQuery(childSpan, query, s.metrics.queryDurationIndex)
childSpan.Finish()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit ad2344b

Please sign in to comment.