Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the Region to the run inspector
  • Loading branch information
matt-aitken committed Aug 6, 2025
commit 7823a7856304c225b7b12353906da59b565c6566
23 changes: 20 additions & 3 deletions apps/webapp/app/presenters/v3/SpanPresenter.server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
MachinePreset,
type MachinePreset,
prettyPrintPacket,
SemanticInternalAttributes,
TaskRunContext,
type TaskRunContext,
TaskRunError,
TriggerTraceContext,
V3TaskRunContext,
type V3TaskRunContext,
} from "@trigger.dev/core/v3";
import { AttemptId, getMaxDuration, parseTraceparent } from "@trigger.dev/core/v3/isomorphic";
import { RUNNING_STATUSES } from "~/components/runs/v3/TaskRunStatus";
Expand Down Expand Up @@ -176,6 +176,22 @@ export class SpanPresenter extends BasePresenter {

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

let region: { name: string; location: string | null } | null = null;

if (run.runtimeEnvironment.type !== "DEVELOPMENT" && run.engine !== "V1") {
const workerGroup = await this._replica.workerInstanceGroup.findFirst({
select: {
name: true,
location: true,
},
where: {
masterQueue: run.workerQueue,
},
});

region = workerGroup ?? null;
}

return {
id: run.id,
friendlyId: run.friendlyId,
Expand Down Expand Up @@ -233,6 +249,7 @@ export class SpanPresenter extends BasePresenter {
maxDurationInSeconds: getMaxDuration(run.maxDurationInSeconds),
batch: run.batch ? { friendlyId: run.batch.friendlyId } : undefined,
engine: run.engine,
region,
workerQueue: run.workerQueue,
spanId: run.spanId,
isCached: !!span.originalRun,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import {
} from "~/utils/pathBuilder";
import { createTimelineSpanEventsFromSpanEvents } from "~/utils/timelineSpanEvents";
import { CompleteWaitpointForm } from "../resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.waitpoints.$waitpointFriendlyId.complete/route";
import { FlagIcon } from "~/assets/icons/RegionIcons";

export const loader = async ({ request, params }: LoaderFunctionArgs) => {
const { projectParam, organizationSlug, envParam, runParam, spanParam } =
Expand Down Expand Up @@ -701,6 +702,19 @@ function RunBody({
<MachineLabelCombo preset={run.machinePreset} />
</Property.Value>
</Property.Item>
{run.region && (
<Property.Item>
<Property.Label>Region</Property.Label>
<Property.Value>
<span className="flex items-center gap-1">
{run.region.location ? (
<FlagIcon region={run.region.location} className="size-5" />
) : null}
{run.region.name}
</span>
</Property.Value>
</Property.Item>
)}
<Property.Item>
<Property.Label>Run invocation cost</Property.Label>
<Property.Value>
Expand Down