From 3d2398768e46ac3198d2214a26445c7116534828 Mon Sep 17 00:00:00 2001 From: JRoger Date: Mon, 22 Jan 2024 17:10:29 +0800 Subject: [PATCH] perf(storage): Use ToListAsync() instead of ToArrayAsync(), because ToArrayAsync() is a wrapper around ToListAsync(). --- .../EntityFrameworkCore/Jaeger/EFJaegerSpanReader.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Mocha.Storage/EntityFrameworkCore/Jaeger/EFJaegerSpanReader.cs b/src/Mocha.Storage/EntityFrameworkCore/Jaeger/EFJaegerSpanReader.cs index 1b87190..32ac3b3 100644 --- a/src/Mocha.Storage/EntityFrameworkCore/Jaeger/EFJaegerSpanReader.cs +++ b/src/Mocha.Storage/EntityFrameworkCore/Jaeger/EFJaegerSpanReader.cs @@ -123,25 +123,25 @@ private static async Task QueryJaegerTracesAsync( IQueryable 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();