Skip to content

feat(site): add agent connection timings #15276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Nov 1, 2024
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
Display agent timings
  • Loading branch information
BrunoQuaresma committed Oct 29, 2024
commit d00a00be2de862cbb1ede1292b4e1b04614ac1b8
5 changes: 3 additions & 2 deletions site/src/api/queries/workspaceBuilds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ export const infiniteWorkspaceBuilds = (
};
};

export const workspaceBuildTimings = (workspaceBuildId: string) => {
// We use readyAgentsCount to invalidate the query when an agent connects
export const workspaceBuildTimings = (workspaceBuildId: string, readyAgentsCount: number) => {
return {
queryKey: ["workspaceBuilds", workspaceBuildId, "timings"],
queryKey: ["workspaceBuilds", workspaceBuildId, "timings", { readyAgentsCount }],
queryFn: () => API.workspaceBuildTimings(workspaceBuildId),
};
};
1 change: 1 addition & 0 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions site/src/modules/workspaces/WorkspaceTiming/ResourcesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import {
makeTicks,
mergeTimeRanges,
} from "./Chart/utils";
import type { StageCategory } from "./StagesChart";
import { type Theme, useTheme } from "@emotion/react";
import type { Stage } from "./StagesChart";

type ResourceTiming = {
name: string;
Expand All @@ -36,14 +37,12 @@ type ResourceTiming = {
};

export type ResourcesChartProps = {
category: StageCategory;
stage: string;
stage: Stage;
timings: ResourceTiming[];
onBack: () => void;
};

export const ResourcesChart: FC<ResourcesChartProps> = ({
category,
stage,
timings,
onBack,
Expand All @@ -67,11 +66,11 @@ export const ResourcesChart: FC<ResourcesChartProps> = ({
<ChartBreadcrumbs
breadcrumbs={[
{
label: category.name,
label: stage.section,
onClick: onBack,
},
{
label: stage,
label: stage.name,
},
]}
/>
Expand All @@ -85,7 +84,7 @@ export const ResourcesChart: FC<ResourcesChartProps> = ({
<ChartContent>
<YAxis>
<YAxisSection>
<YAxisHeader>{stage} stage</YAxisHeader>
<YAxisHeader>{stage.name} stage</YAxisHeader>
<YAxisLabels>
{visibleTimings.map((t) => (
<YAxisLabel key={t.name} id={encodeURIComponent(t.name)}>
Expand Down
12 changes: 5 additions & 7 deletions site/src/modules/workspaces/WorkspaceTiming/ScriptsChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
makeTicks,
mergeTimeRanges,
} from "./Chart/utils";
import type { StageCategory } from "./StagesChart";
import type { Stage } from "./StagesChart";

type ScriptTiming = {
name: string;
Expand All @@ -37,14 +37,12 @@ type ScriptTiming = {
};

export type ScriptsChartProps = {
category: StageCategory;
stage: string;
stage: Stage;
timings: ScriptTiming[];
onBack: () => void;
};

export const ScriptsChart: FC<ScriptsChartProps> = ({
category,
stage,
timings,
onBack,
Expand All @@ -66,11 +64,11 @@ export const ScriptsChart: FC<ScriptsChartProps> = ({
<ChartBreadcrumbs
breadcrumbs={[
{
label: category.name,
label: stage.section,
onClick: onBack,
},
{
label: stage,
label: stage.name,
},
]}
/>
Expand All @@ -84,7 +82,7 @@ export const ScriptsChart: FC<ScriptsChartProps> = ({
<ChartContent>
<YAxis>
<YAxisSection>
<YAxisHeader>{stage} stage</YAxisHeader>
<YAxisHeader>{stage.name} stage</YAxisHeader>
<YAxisLabels>
{visibleTimings.map((t) => (
<YAxisLabel key={t.name} id={encodeURIComponent(t.name)}>
Expand Down
Loading