Skip to content

Commit

Permalink
perf(storage): Use ToListAsync() instead of ToArrayAsync(), because T…
Browse files Browse the repository at this point in the history
…oArrayAsync() is a wrapper around ToListAsync().
  • Loading branch information
netcore-jroger committed Jan 22, 2024
1 parent a6910fe commit 3d23987
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,25 @@ private static async Task<JaegerTrace[]> QueryJaegerTracesAsync(
IQueryable<EFSpan> queryableSpans,
MochaContext context)
{
var spans = await queryableSpans.ToArrayAsync();
var spans = await queryableSpans.ToListAsync();

var spanIds = spans.Select(s => s.SpanId).ToArray();

var spanAttributes = await context.SpanAttributes
.Where(a => spanIds.Contains(a.SpanId))
.ToArrayAsync();
.ToListAsync();

var resourceAttributes = await context.ResourceAttributes
.Where(a => spanIds.Contains(a.SpanId))
.ToArrayAsync();
.ToListAsync();

var spanEvents = await context.SpanEvents
.Where(e => spanIds.Contains(e.SpanId))
.ToArrayAsync();
.ToListAsync();

var spanEventAttributes = await context.SpanEventAttributes
.Where(a => spanIds.Contains(a.SpanId))
.ToArrayAsync();
.ToListAsync();

var jaegerTraces = spans.ToJaegerTraces(
spanAttributes, resourceAttributes, spanEvents, spanEventAttributes).ToArray();
Expand Down

0 comments on commit 3d23987

Please sign in to comment.