Skip to content

Commit 8cd190d

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/image-cache-prep
2 parents 96fbeeb + d622aba commit 8cd190d

File tree

49 files changed

+1190
-556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1190
-556
lines changed

.changeset/lemon-fireants-repair.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/lovely-toys-obey.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/webapp/app/components/runs/v3/RunInspector.tsx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ import { cn } from "~/utils/cn";
3232
import { formatCurrencyAccurate } from "~/utils/numberFormatter";
3333
import {
3434
v3RunDownloadLogsPath,
35-
v3RunPath,
3635
v3RunSpanPath,
3736
v3RunsPath,
3837
v3SchedulePath,
39-
v3TraceSpanPath,
4038
} from "~/utils/pathBuilder";
4139
import { TraceSpan } from "~/utils/taskEvent";
42-
import { SpanLink } from "~/v3/eventRepository.server";
4340
import { isFailedRunStatus, isFinalRunStatus } from "~/v3/taskStatus";
4441
import { RunTimelineEvent, RunTimelineLine } from "./InspectorTimeline";
4542
import { RunTag } from "./RunTag";
@@ -317,18 +314,6 @@ export function RunInspector({
317314
)}
318315
</Property.Value>
319316
</Property.Item>
320-
{span?.links && span.links.length > 0 && (
321-
<Property.Item>
322-
<Property.Label>Links</Property.Label>
323-
<Property.Value>
324-
<div className="space-y-1">
325-
{span.links.map((link, index) => (
326-
<SpanLinkElement key={index} link={link} />
327-
))}
328-
</div>
329-
</Property.Value>
330-
</Property.Item>
331-
)}
332317
<Property.Item>
333318
<Property.Label>Max duration</Property.Label>
334319
<Property.Value>
@@ -647,27 +632,3 @@ function PacketDisplay({
647632
}
648633
}
649634
}
650-
651-
function SpanLinkElement({ link }: { link: SpanLink }) {
652-
const organization = useOrganization();
653-
const project = useProject();
654-
655-
switch (link.type) {
656-
case "run": {
657-
return (
658-
<TextLink to={v3RunPath(organization, project, { friendlyId: link.runId })}>
659-
{link.title}
660-
</TextLink>
661-
);
662-
}
663-
case "span": {
664-
return (
665-
<TextLink to={v3TraceSpanPath(organization, project, link.traceId, link.spanId)}>
666-
{link.title}
667-
</TextLink>
668-
);
669-
}
670-
}
671-
672-
return null;
673-
}

apps/webapp/app/components/runs/v3/SpanInspector.tsx

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { formatDuration, nanosecondsToMilliseconds } from "@trigger.dev/core/v3";
12
import { ExitIcon } from "~/assets/icons/ExitIcon";
23
import { CodeBlock } from "~/components/code/CodeBlock";
34
import { Button } from "~/components/primitives/Buttons";
45
import { DateTimeAccurate } from "~/components/primitives/DateTime";
56
import { Header2 } from "~/components/primitives/Headers";
67
import * as Property from "~/components/primitives/PropertyTable";
8+
import { Spinner } from "~/components/primitives/Spinner";
79
import { TabButton, TabContainer } from "~/components/primitives/Tabs";
810
import { TextLink } from "~/components/primitives/TextLink";
911
import { InfoIconTooltip, SimpleTooltip } from "~/components/primitives/Tooltip";
@@ -15,13 +17,10 @@ import { useOrganization } from "~/hooks/useOrganizations";
1517
import { useProject } from "~/hooks/useProject";
1618
import { useSearchParams } from "~/hooks/useSearchParam";
1719
import { cn } from "~/utils/cn";
18-
import { v3RunPath, v3RunsPath, v3TraceSpanPath } from "~/utils/pathBuilder";
20+
import { v3RunsPath } from "~/utils/pathBuilder";
1921
import { TraceSpan } from "~/utils/taskEvent";
20-
import { SpanLink } from "~/v3/eventRepository.server";
2122
import { RunTimelineEvent, RunTimelineLine } from "./InspectorTimeline";
22-
import { Spinner } from "~/components/primitives/Spinner";
2323
import { LiveTimer } from "./LiveTimer";
24-
import { formatDuration, nanosecondsToMilliseconds } from "@trigger.dev/core/v3";
2524

2625
export function SpanInspector({
2726
span,
@@ -150,18 +149,6 @@ export function SpanInspector({
150149
)}
151150
</Property.Value>
152151
</Property.Item>
153-
{span.links && span.links.length > 0 && (
154-
<Property.Item>
155-
<Property.Label>Links</Property.Label>
156-
<Property.Value>
157-
<div className="space-y-1">
158-
{span.links.map((link, index) => (
159-
<SpanLinkElement key={index} link={link} />
160-
))}
161-
</div>
162-
</Property.Value>
163-
</Property.Item>
164-
)}
165152
</Property.Table>
166153
</div>
167154
) : (
@@ -203,18 +190,6 @@ export function SpanInspector({
203190
<Property.Label>Message</Property.Label>
204191
<Property.Value>{span.message}</Property.Value>
205192
</Property.Item>
206-
{span.links && span.links.length > 0 && (
207-
<Property.Item>
208-
<Property.Label>Links</Property.Label>
209-
<Property.Value>
210-
<div className="space-y-1">
211-
{span.links.map((link, index) => (
212-
<SpanLinkElement key={index} link={link} />
213-
))}
214-
</div>
215-
</Property.Value>
216-
</Property.Item>
217-
)}
218193
</Property.Table>
219194

220195
{span.events !== undefined && <SpanEvents spanEvents={span.events} />}
@@ -287,27 +262,3 @@ export function SpanTimeline({ startTime, duration, inProgress, isError }: Timel
287262
</>
288263
);
289264
}
290-
291-
function SpanLinkElement({ link }: { link: SpanLink }) {
292-
const organization = useOrganization();
293-
const project = useProject();
294-
295-
switch (link.type) {
296-
case "run": {
297-
return (
298-
<TextLink to={v3RunPath(organization, project, { friendlyId: link.runId })}>
299-
{link.title}
300-
</TextLink>
301-
);
302-
}
303-
case "span": {
304-
return (
305-
<TextLink to={v3TraceSpanPath(organization, project, link.traceId, link.spanId)}>
306-
{link.title}
307-
</TextLink>
308-
);
309-
}
310-
}
311-
312-
return null;
313-
}

apps/webapp/app/env.server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,9 @@ const EnvironmentSchema = z.object({
442442
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
443443
LEGACY_RUN_ENGINE_WORKER_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
444444

445+
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_SIZE: z.coerce.number().int().default(100),
446+
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_STAGGER_MS: z.coerce.number().int().default(1_000),
447+
445448
COMMON_WORKER_ENABLED: z.string().default(process.env.WORKER_ENABLED ?? "true"),
446449
COMMON_WORKER_CONCURRENCY_WORKERS: z.coerce.number().int().default(2),
447450
COMMON_WORKER_CONCURRENCY_TASKS_PER_WORKER: z.coerce.number().int().default(10),
@@ -478,6 +481,9 @@ const EnvironmentSchema = z.object({
478481
.transform((v) => v ?? process.env.REDIS_PASSWORD),
479482
COMMON_WORKER_REDIS_TLS_DISABLED: z.string().default(process.env.REDIS_TLS_DISABLED ?? "false"),
480483
COMMON_WORKER_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
484+
485+
TASK_EVENT_PARTITIONING_ENABLED: z.string().default("0"),
486+
TASK_EVENT_PARTITIONED_WINDOW_IN_SECONDS: z.coerce.number().int().default(60), // 1 minute
481487
});
482488

483489
export type Environment = z.infer<typeof EnvironmentSchema>;

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createTreeFromFlatItems, flattenTree } from "~/components/primitives/Tr
33
import { PrismaClient, prisma } from "~/db.server";
44
import { getUsername } from "~/utils/username";
55
import { eventRepository } from "~/v3/eventRepository.server";
6+
import { getTaskEventStoreTableForRun } from "~/v3/taskEventStore.server";
67
import { isFinalRunStatus } from "~/v3/taskStatus";
78

89
type Result = Awaited<ReturnType<RunPresenter["call"]>>;
@@ -32,6 +33,8 @@ export class RunPresenter {
3233
const run = await this.#prismaClient.taskRun.findFirstOrThrow({
3334
select: {
3435
id: true,
36+
createdAt: true,
37+
taskEventStore: true,
3538
number: true,
3639
traceId: true,
3740
spanId: true,
@@ -44,6 +47,7 @@ export class RunPresenter {
4447
friendlyId: true,
4548
taskIdentifier: true,
4649
spanId: true,
50+
createdAt: true,
4751
},
4852
},
4953
runtimeEnvironment: {
@@ -105,7 +109,12 @@ export class RunPresenter {
105109
}
106110

107111
// get the events
108-
const traceSummary = await eventRepository.getTraceSummary(run.traceId);
112+
const traceSummary = await eventRepository.getTraceSummary(
113+
getTaskEventStoreTableForRun(run),
114+
run.traceId,
115+
run.rootTaskRun?.createdAt ?? run.createdAt,
116+
run.completedAt ?? undefined
117+
);
109118
if (!traceSummary) {
110119
return {
111120
run: runData,

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { machinePresetFromName } from "~/v3/machinePresets.server";
1010
import { FINAL_ATTEMPT_STATUSES, isFailedRunStatus, isFinalRunStatus } from "~/v3/taskStatus";
1111
import { BasePresenter } from "./basePresenter.server";
1212
import { getMaxDuration } from "~/v3/utils/maxDuration";
13+
import { getTaskEventStoreTableForRun } from "~/v3/taskEventStore.server";
1314

1415
type Result = Awaited<ReturnType<SpanPresenter["call"]>>;
1516
export type Span = NonNullable<NonNullable<Result>["span"]>;
@@ -71,6 +72,7 @@ export class SpanPresenter extends BasePresenter {
7172
friendlyId: true,
7273
isTest: true,
7374
maxDurationInSeconds: true,
75+
taskEventStore: true,
7476
tags: {
7577
select: {
7678
name: true,
@@ -133,6 +135,7 @@ export class SpanPresenter extends BasePresenter {
133135
taskIdentifier: true,
134136
friendlyId: true,
135137
spanId: true,
138+
createdAt: true,
136139
},
137140
},
138141
parentTaskRun: {
@@ -205,7 +208,13 @@ export class SpanPresenter extends BasePresenter {
205208
}
206209
}
207210

208-
const span = await eventRepository.getSpan(spanId, run.traceId);
211+
const span = await eventRepository.getSpan(
212+
getTaskEventStoreTableForRun(run),
213+
spanId,
214+
run.traceId,
215+
run.rootTaskRun?.createdAt ?? run.createdAt,
216+
run.completedAt ?? undefined
217+
);
209218

210219
const metadata = run.metadata
211220
? await prettyPrintPacket(run.metadata, run.metadataType, {
@@ -342,6 +351,9 @@ export class SpanPresenter extends BasePresenter {
342351
const run = await this._prisma.taskRun.findFirst({
343352
select: {
344353
traceId: true,
354+
createdAt: true,
355+
completedAt: true,
356+
taskEventStore: true,
345357
},
346358
where: {
347359
friendlyId: runFriendlyId,
@@ -352,7 +364,13 @@ export class SpanPresenter extends BasePresenter {
352364
return;
353365
}
354366

355-
const span = await eventRepository.getSpan(spanId, run.traceId);
367+
const span = await eventRepository.getSpan(
368+
getTaskEventStoreTableForRun(run),
369+
spanId,
370+
run.traceId,
371+
run.createdAt,
372+
run.completedAt ?? undefined
373+
);
356374

357375
if (!span) {
358376
return;

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.v3.$projectParam.traces.$traceId.spans.$spanId/route.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import { RunTag } from "~/components/runs/v3/RunTag";
4444
import { SpanEvents } from "~/components/runs/v3/SpanEvents";
4545
import { SpanTitle } from "~/components/runs/v3/SpanTitle";
4646
import { TaskRunAttemptStatusCombo } from "~/components/runs/v3/TaskRunAttemptStatus";
47-
import { TaskRunsTable } from "~/components/runs/v3/TaskRunsTable";
4847
import { TaskRunStatusCombo } from "~/components/runs/v3/TaskRunStatus";
4948
import { useOrganization } from "~/hooks/useOrganizations";
5049
import { useProject } from "~/hooks/useProject";
@@ -57,16 +56,13 @@ import { cn } from "~/utils/cn";
5756
import { formatCurrencyAccurate } from "~/utils/numberFormatter";
5857
import {
5958
v3BatchPath,
60-
v3BatchRunsPath,
6159
v3RunDownloadLogsPath,
6260
v3RunPath,
6361
v3RunSpanPath,
6462
v3RunsPath,
6563
v3SchedulePath,
6664
v3SpanParamsSchema,
67-
v3TraceSpanPath,
6865
} from "~/utils/pathBuilder";
69-
import { SpanLink } from "~/v3/eventRepository.server";
7066

7167
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
7268
const userId = await requireUserId(request);
@@ -1152,27 +1148,3 @@ function classNameForState(state: TimelineState) {
11521148
}
11531149
}
11541150
}
1155-
1156-
function SpanLinkElement({ link }: { link: SpanLink }) {
1157-
const organization = useOrganization();
1158-
const project = useProject();
1159-
1160-
switch (link.type) {
1161-
case "run": {
1162-
return (
1163-
<TextLink to={v3RunPath(organization, project, { friendlyId: link.runId })}>
1164-
{link.title}
1165-
</TextLink>
1166-
);
1167-
}
1168-
case "span": {
1169-
return (
1170-
<TextLink to={v3TraceSpanPath(organization, project, link.traceId, link.spanId)}>
1171-
{link.title}
1172-
</TextLink>
1173-
);
1174-
}
1175-
}
1176-
1177-
return null;
1178-
}

0 commit comments

Comments
 (0)