Skip to content

Commit a306545

Browse files
authored
Always find debug logs when in the span sidebar (#2093)
1 parent 1bb1fc4 commit a306545

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

apps/webapp/app/presenters/v3/SpanPresenter.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
isWaitpointOutputTimeout,
32
type MachinePresetName,
43
prettyPrintPacket,
54
SemanticInternalAttributes,
@@ -423,7 +422,8 @@ export class SpanPresenter extends BasePresenter {
423422
spanId,
424423
traceId,
425424
createdAt,
426-
completedAt ?? undefined
425+
completedAt ?? undefined,
426+
{ includeDebugLogs: true }
427427
);
428428
if (!span) {
429429
return;

apps/webapp/app/v3/eventRepository.server.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,17 @@ export class EventRepository {
576576
spanId: string,
577577
traceId: string,
578578
startCreatedAt: Date,
579-
endCreatedAt?: Date
579+
endCreatedAt?: Date,
580+
options?: { includeDebugLogs?: boolean }
580581
) {
581582
return await startActiveSpan("getSpan", async (s) => {
582-
const spanEvent = await this.#getSpanEvent(storeTable, spanId, startCreatedAt, endCreatedAt);
583+
const spanEvent = await this.#getSpanEvent(
584+
storeTable,
585+
spanId,
586+
startCreatedAt,
587+
endCreatedAt,
588+
options
589+
);
583590

584591
if (!spanEvent) {
585592
return;
@@ -786,7 +793,8 @@ export class EventRepository {
786793
storeTable: TaskEventStoreTable,
787794
spanId: string,
788795
startCreatedAt: Date,
789-
endCreatedAt?: Date
796+
endCreatedAt?: Date,
797+
options?: { includeDebugLogs?: boolean }
790798
) {
791799
return await startActiveSpan("getSpanEvent", async (s) => {
792800
const events = await this.taskEventStore.findMany(
@@ -797,7 +805,8 @@ export class EventRepository {
797805
undefined,
798806
{
799807
startTime: "asc",
800-
}
808+
},
809+
options
801810
);
802811

803812
let finalEvent: TaskEvent | undefined;

apps/webapp/app/v3/taskEventStore.server.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export class TaskEventStore {
7676
startCreatedAt: Date,
7777
endCreatedAt?: Date,
7878
select?: TSelect,
79-
orderBy?: Prisma.TaskEventOrderByWithRelationInput
79+
orderBy?: Prisma.TaskEventOrderByWithRelationInput,
80+
options?: { includeDebugLogs?: boolean }
8081
): Promise<Prisma.TaskEventGetPayload<{ select: TSelect }>[]> {
8182
let finalWhere: Prisma.TaskEventWhereInput = where;
8283

@@ -99,13 +100,14 @@ export class TaskEventStore {
99100
};
100101
}
101102

103+
const filterDebug =
104+
options?.includeDebugLogs === false || options?.includeDebugLogs === undefined;
105+
102106
if (table === "taskEventPartitioned") {
103107
return (await this.readReplica.taskEventPartitioned.findMany({
104108
where: {
105109
...(finalWhere as Prisma.TaskEventPartitionedWhereInput),
106-
kind: {
107-
not: "LOG",
108-
},
110+
...(filterDebug ? { kind: { not: "LOG" } } : {}),
109111
},
110112
select,
111113
orderBy,
@@ -115,9 +117,7 @@ export class TaskEventStore {
115117
return (await this.readReplica.taskEvent.findMany({
116118
where: {
117119
...(finalWhere as Prisma.TaskEventWhereInput),
118-
kind: {
119-
not: "LOG",
120-
},
120+
...(filterDebug ? { kind: { not: "LOG" } } : {}),
121121
},
122122
select,
123123
orderBy,

0 commit comments

Comments
 (0)