Skip to content

Commit 036a414

Browse files
committed
Fix for getting the correct value from the metadata
1 parent f5317b7 commit 036a414

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { getMaxDuration } from "@trigger.dev/core/v3/isomorphic";
99
import { RUNNING_STATUSES } from "~/components/runs/v3/TaskRunStatus";
1010
import { logger } from "~/services/logger.server";
11-
import { eventRepository } from "~/v3/eventRepository.server";
11+
import { eventRepository, rehydrateAttribute } from "~/v3/eventRepository.server";
1212
import { machinePresetFromName } from "~/v3/machinePresets.server";
1313
import { getTaskEventStoreTableForRun, type TaskEventStoreTable } from "~/v3/taskEventStore.server";
1414
import { isFailedRunStatus, isFinalRunStatus } from "~/v3/taskStatus";
@@ -489,12 +489,17 @@ export class SpanPresenter extends BasePresenter {
489489
};
490490
}
491491
case "attempt": {
492+
const isWarmStart = rehydrateAttribute<boolean>(
493+
span.metadata,
494+
SemanticInternalAttributes.WARM_START
495+
);
496+
492497
return {
493498
...data,
494499
entity: {
495500
type: "attempt" as const,
496501
object: {
497-
isWarmStart: isWarmStart(span.properties),
502+
isWarmStart,
498503
},
499504
},
500505
};

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ function rehydrateShow(properties: Prisma.JsonValue): { actions?: boolean } | un
16381638
return;
16391639
}
16401640

1641-
function rehydrateAttribute<T extends AttributeValue>(
1641+
export function rehydrateAttribute<T extends AttributeValue>(
16421642
properties: Prisma.JsonValue,
16431643
key: string
16441644
): T | undefined {
@@ -1656,7 +1656,9 @@ function rehydrateAttribute<T extends AttributeValue>(
16561656

16571657
const value = properties[key];
16581658

1659-
if (!value) return;
1659+
if (value === undefined) {
1660+
return;
1661+
}
16601662

16611663
return value as T;
16621664
}

0 commit comments

Comments
 (0)