Skip to content

Commit 7823a78

Browse files
committed
Added the Region to the run inspector
1 parent af16c9d commit 7823a78

File tree

2 files changed

+34
-3
lines changed
  • apps/webapp/app

2 files changed

+34
-3
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import {
2-
MachinePreset,
2+
type MachinePreset,
33
prettyPrintPacket,
44
SemanticInternalAttributes,
5-
TaskRunContext,
5+
type TaskRunContext,
66
TaskRunError,
77
TriggerTraceContext,
8-
V3TaskRunContext,
8+
type V3TaskRunContext,
99
} from "@trigger.dev/core/v3";
1010
import { AttemptId, getMaxDuration, parseTraceparent } from "@trigger.dev/core/v3/isomorphic";
1111
import { RUNNING_STATUSES } from "~/components/runs/v3/TaskRunStatus";
@@ -176,6 +176,22 @@ export class SpanPresenter extends BasePresenter {
176176

177177
const externalTraceId = this.#getExternalTraceId(run.traceContext);
178178

179+
let region: { name: string; location: string | null } | null = null;
180+
181+
if (run.runtimeEnvironment.type !== "DEVELOPMENT" && run.engine !== "V1") {
182+
const workerGroup = await this._replica.workerInstanceGroup.findFirst({
183+
select: {
184+
name: true,
185+
location: true,
186+
},
187+
where: {
188+
masterQueue: run.workerQueue,
189+
},
190+
});
191+
192+
region = workerGroup ?? null;
193+
}
194+
179195
return {
180196
id: run.id,
181197
friendlyId: run.friendlyId,
@@ -233,6 +249,7 @@ export class SpanPresenter extends BasePresenter {
233249
maxDurationInSeconds: getMaxDuration(run.maxDurationInSeconds),
234250
batch: run.batch ? { friendlyId: run.batch.friendlyId } : undefined,
235251
engine: run.engine,
252+
region,
236253
workerQueue: run.workerQueue,
237254
spanId: run.spanId,
238255
isCached: !!span.originalRun,

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import {
7676
} from "~/utils/pathBuilder";
7777
import { createTimelineSpanEventsFromSpanEvents } from "~/utils/timelineSpanEvents";
7878
import { CompleteWaitpointForm } from "../resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.$waitpointFriendlyId.complete/route";
79+
import { FlagIcon } from "~/assets/icons/RegionIcons";
7980

8081
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
8182
const { projectParam, organizationSlug, envParam, runParam, spanParam } =
@@ -701,6 +702,19 @@ function RunBody({
701702
<MachineLabelCombo preset={run.machinePreset} />
702703
</Property.Value>
703704
</Property.Item>
705+
{run.region && (
706+
<Property.Item>
707+
<Property.Label>Region</Property.Label>
708+
<Property.Value>
709+
<span className="flex items-center gap-1">
710+
{run.region.location ? (
711+
<FlagIcon region={run.region.location} className="size-5" />
712+
) : null}
713+
{run.region.name}
714+
</span>
715+
</Property.Value>
716+
</Property.Item>
717+
)}
704718
<Property.Item>
705719
<Property.Label>Run invocation cost</Property.Label>
706720
<Property.Value>

0 commit comments

Comments
 (0)