Skip to content

Commit 0d5eb9f

Browse files
committed
simplify getSpan and remove some unnecessary properties
1 parent 155fc5e commit 0d5eb9f

File tree

6 files changed

+22
-677
lines changed

6 files changed

+22
-677
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,23 @@ export class SpanPresenter extends BasePresenter {
459459
});
460460

461461
const data = {
462-
...span,
462+
spanId: span.spanId,
463+
parentId: span.parentId,
464+
message: span.message,
465+
isError: span.isError,
466+
isPartial: span.isPartial,
467+
isCancelled: span.isCancelled,
468+
level: span.level,
469+
kind: span.kind,
470+
startTime: span.startTime,
471+
duration: span.duration,
463472
events: span.events,
473+
style: span.style,
464474
properties: span.properties ? JSON.stringify(span.properties, null, 2) : undefined,
475+
entity: span.entity,
476+
originalRun: span.originalRun,
477+
metadata: span.metadata,
465478
triggeredRuns,
466-
showActionBar: span.show?.actions === true,
467479
};
468480

469481
switch (span.entity.type) {

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route.tsx

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -232,83 +232,10 @@ function SpanBody({
232232
>
233233
Overview
234234
</TabButton>
235-
<TabButton
236-
isActive={tab === "detail"}
237-
layoutId="span-span"
238-
onClick={() => {
239-
replace({ tab: "detail" });
240-
}}
241-
shortcut={{ key: "d" }}
242-
>
243-
Detail
244-
</TabButton>
245235
</TabContainer>
246236
</div>
247237
<div className="overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
248-
{tab === "detail" ? (
249-
<div className="flex flex-col gap-4 px-3 pt-3">
250-
<Property.Table>
251-
<Property.Item>
252-
<Property.Label>Status</Property.Label>
253-
<Property.Value>
254-
<TaskRunAttemptStatusCombo
255-
status={
256-
span.isCancelled
257-
? "CANCELED"
258-
: span.isError
259-
? "FAILED"
260-
: span.isPartial
261-
? "EXECUTING"
262-
: "COMPLETED"
263-
}
264-
className="text-sm"
265-
/>
266-
</Property.Value>
267-
</Property.Item>
268-
<Property.Item>
269-
<Property.Label>Task</Property.Label>
270-
<Property.Value>
271-
<SimpleTooltip
272-
button={
273-
<TextLink
274-
to={v3RunsPath(organization, project, environment, {
275-
tasks: [span.taskSlug],
276-
})}
277-
>
278-
{span.taskSlug}
279-
</TextLink>
280-
}
281-
content={`Filter runs by ${span.taskSlug}`}
282-
/>
283-
</Property.Value>
284-
</Property.Item>
285-
{span.idempotencyKey && (
286-
<Property.Item>
287-
<Property.Label>Idempotency key</Property.Label>
288-
<Property.Value>{span.idempotencyKey}</Property.Value>
289-
</Property.Item>
290-
)}
291-
<Property.Item>
292-
<Property.Label>Version</Property.Label>
293-
<Property.Value>
294-
{span.workerVersion ? (
295-
span.workerVersion
296-
) : (
297-
<span className="flex items-center gap-1">
298-
<span>Never started</span>
299-
<InfoIconTooltip
300-
content={"Runs get locked to the latest version when they start."}
301-
contentClassName="normal-case tracking-normal"
302-
/>
303-
</span>
304-
)}
305-
</Property.Value>
306-
</Property.Item>
307-
</Property.Table>
308-
</div>
309-
) : (
310-
<SpanEntity span={span} />
311-
)}
238+
<SpanEntity span={span} />
312239
</div>
313240
</div>
314241
);

apps/webapp/app/routes/resources.runs.$runParam.logs.download.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { RunPreparedEvent } from "~/v3/eventRepository.types";
77
import { createGzip } from "zlib";
88
import { Readable } from "stream";
99
import { formatDurationMilliseconds } from "@trigger.dev/core/v3/utils/durations";
10-
import { getDateFromNanoseconds } from "~/utils/taskEvent";
1110
import { getTaskEventStoreTableForRun } from "~/v3/taskEventStore.server";
1211
import { TaskEventKind } from "@trigger.dev/database";
1312

@@ -118,3 +117,7 @@ function formatRunEvent(event: RunPreparedEvent): string {
118117

119118
return entries.join("\n");
120119
}
120+
121+
function getDateFromNanoseconds(nanoseconds: bigint) {
122+
return new Date(Number(nanoseconds) / 1_000_000);
123+
}

0 commit comments

Comments
 (0)