From 3a010e40d794a166984a8b1ca79ebe04f6aea6f5 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Thu, 22 May 2025 13:37:20 +0100 Subject: [PATCH] Always find debug logs when in the span sidebar --- .../app/presenters/v3/SpanPresenter.server.ts | 4 ++-- apps/webapp/app/v3/eventRepository.server.ts | 17 +++++++++++++---- apps/webapp/app/v3/taskEventStore.server.ts | 14 +++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/webapp/app/presenters/v3/SpanPresenter.server.ts b/apps/webapp/app/presenters/v3/SpanPresenter.server.ts index 00f2846072..3caad87910 100644 --- a/apps/webapp/app/presenters/v3/SpanPresenter.server.ts +++ b/apps/webapp/app/presenters/v3/SpanPresenter.server.ts @@ -1,5 +1,4 @@ import { - isWaitpointOutputTimeout, type MachinePresetName, prettyPrintPacket, SemanticInternalAttributes, @@ -423,7 +422,8 @@ export class SpanPresenter extends BasePresenter { spanId, traceId, createdAt, - completedAt ?? undefined + completedAt ?? undefined, + { includeDebugLogs: true } ); if (!span) { return; diff --git a/apps/webapp/app/v3/eventRepository.server.ts b/apps/webapp/app/v3/eventRepository.server.ts index f495d0f170..067302aba9 100644 --- a/apps/webapp/app/v3/eventRepository.server.ts +++ b/apps/webapp/app/v3/eventRepository.server.ts @@ -576,10 +576,17 @@ export class EventRepository { spanId: string, traceId: string, startCreatedAt: Date, - endCreatedAt?: Date + endCreatedAt?: Date, + options?: { includeDebugLogs?: boolean } ) { return await startActiveSpan("getSpan", async (s) => { - const spanEvent = await this.#getSpanEvent(storeTable, spanId, startCreatedAt, endCreatedAt); + const spanEvent = await this.#getSpanEvent( + storeTable, + spanId, + startCreatedAt, + endCreatedAt, + options + ); if (!spanEvent) { return; @@ -786,7 +793,8 @@ export class EventRepository { storeTable: TaskEventStoreTable, spanId: string, startCreatedAt: Date, - endCreatedAt?: Date + endCreatedAt?: Date, + options?: { includeDebugLogs?: boolean } ) { return await startActiveSpan("getSpanEvent", async (s) => { const events = await this.taskEventStore.findMany( @@ -797,7 +805,8 @@ export class EventRepository { undefined, { startTime: "asc", - } + }, + options ); let finalEvent: TaskEvent | undefined; diff --git a/apps/webapp/app/v3/taskEventStore.server.ts b/apps/webapp/app/v3/taskEventStore.server.ts index 0b486d4a87..1f926e89f8 100644 --- a/apps/webapp/app/v3/taskEventStore.server.ts +++ b/apps/webapp/app/v3/taskEventStore.server.ts @@ -76,7 +76,8 @@ export class TaskEventStore { startCreatedAt: Date, endCreatedAt?: Date, select?: TSelect, - orderBy?: Prisma.TaskEventOrderByWithRelationInput + orderBy?: Prisma.TaskEventOrderByWithRelationInput, + options?: { includeDebugLogs?: boolean } ): Promise[]> { let finalWhere: Prisma.TaskEventWhereInput = where; @@ -99,13 +100,14 @@ export class TaskEventStore { }; } + const filterDebug = + options?.includeDebugLogs === false || options?.includeDebugLogs === undefined; + if (table === "taskEventPartitioned") { return (await this.readReplica.taskEventPartitioned.findMany({ where: { ...(finalWhere as Prisma.TaskEventPartitionedWhereInput), - kind: { - not: "LOG", - }, + ...(filterDebug ? { kind: { not: "LOG" } } : {}), }, select, orderBy, @@ -115,9 +117,7 @@ export class TaskEventStore { return (await this.readReplica.taskEvent.findMany({ where: { ...(finalWhere as Prisma.TaskEventWhereInput), - kind: { - not: "LOG", - }, + ...(filterDebug ? { kind: { not: "LOG" } } : {}), }, select, orderBy,