diff --git a/src/constants/externalResources.test.ts b/src/constants/externalResources.test.ts index 2beef1584b..0415ac138f 100644 --- a/src/constants/externalResources.test.ts +++ b/src/constants/externalResources.test.ts @@ -65,16 +65,28 @@ describe("getTaskTraceUrl", () => { }); }); -describe("getTaskSystemMetricsUrl", () => { +describe("getHoneycombSystemMetricsUrl", () => { it("generates the correct url", () => { expect( getHoneycombSystemMetricsUrl( "task_12345", + [], new Date("2023-07-07T19:08:41"), new Date("2023-07-07T20:00:00") ) ).toBe( `/datasets/evergreen?query={"calculations":[{"op":"AVG","column":"system.memory.usage.used"},{"op":"AVG","column":"system.cpu.utilization"},{"op":"RATE_AVG","column":"system.network.io.transmit"},{"op":"RATE_AVG","column":"system.network.io.receive"}],"filters":[{"op":"=","column":"evergreen.task.id","value":"task_12345"}],"start_time":1688756921,"end_time":1688760000}&omitMissingValues` ); + + expect( + getHoneycombSystemMetricsUrl( + "task_12345", + ["disk1", "disk2"], + new Date("2023-07-07T19:08:41"), + new Date("2023-07-07T20:00:00") + ) + ).toBe( + `/datasets/evergreen?query={"calculations":[{"op":"AVG","column":"system.memory.usage.used"},{"op":"AVG","column":"system.cpu.utilization"},{"op":"RATE_AVG","column":"system.network.io.transmit"},{"op":"RATE_AVG","column":"system.network.io.receive"},{"op":"RATE_AVG","column":"system.disk.io.disk1.read"},{"op":"RATE_AVG","column":"system.disk.io.disk1.write"},{"op":"RATE_AVG","column":"system.disk.operations.disk1.read"},{"op":"RATE_AVG","column":"system.disk.operations.disk1.write"},{"op":"RATE_AVG","column":"system.disk.io_time.disk1"},{"op":"RATE_AVG","column":"system.disk.io.disk2.read"},{"op":"RATE_AVG","column":"system.disk.io.disk2.write"},{"op":"RATE_AVG","column":"system.disk.operations.disk2.read"},{"op":"RATE_AVG","column":"system.disk.operations.disk2.write"},{"op":"RATE_AVG","column":"system.disk.io_time.disk2"}],"filters":[{"op":"=","column":"evergreen.task.id","value":"task_12345"}],"start_time":1688756921,"end_time":1688760000}&omitMissingValues` + ); }); }); diff --git a/src/constants/externalResources.ts b/src/constants/externalResources.ts index d4b6e97e9a..b571046255 100644 --- a/src/constants/externalResources.ts +++ b/src/constants/externalResources.ts @@ -114,6 +114,7 @@ export const getHoneycombTraceUrl = ( export const getHoneycombSystemMetricsUrl = ( taskId: string, + diskDevices: string[], startTs: Date, endTs: Date ): string => { @@ -123,7 +124,18 @@ export const getHoneycombSystemMetricsUrl = ( { op: "AVG", column: "system.cpu.utilization" }, { op: "RATE_AVG", column: "system.network.io.transmit" }, { op: "RATE_AVG", column: "system.network.io.receive" }, - ], + ].concat( + diskDevices.flatMap((device) => [ + { op: "RATE_AVG", column: `system.disk.io.${device}.read` }, + { op: "RATE_AVG", column: `system.disk.io.${device}.write` }, + { op: "RATE_AVG", column: `system.disk.operations.${device}.read` }, + { + op: "RATE_AVG", + column: `system.disk.operations.${device}.write`, + }, + { op: "RATE_AVG", column: `system.disk.io_time.${device}` }, + ]) + ), filters: [{ op: "=", column: "evergreen.task.id", value: taskId }], start_time: getUnixTime(new Date(startTs)), end_time: getUnixTime(new Date(endTs)), diff --git a/src/gql/generated/types.ts b/src/gql/generated/types.ts index a884f8bd7f..856b0dee48 100644 --- a/src/gql/generated/types.ts +++ b/src/gql/generated/types.ts @@ -2567,6 +2567,7 @@ export type TaskContainerCreationOpts = { export type TaskEndDetail = { __typename?: "TaskEndDetail"; description?: Maybe; + diskDevices: Array; oomTracker: OomTrackerInfo; status: Scalars["String"]["output"]; timedOut?: Maybe; @@ -8510,6 +8511,7 @@ export type TaskQuery = { details?: { __typename?: "TaskEndDetail"; description?: string | null; + diskDevices: Array; status: string; timedOut?: boolean | null; timeoutType?: string | null; diff --git a/src/gql/queries/task.graphql b/src/gql/queries/task.graphql index e8931efb59..742884fa45 100644 --- a/src/gql/queries/task.graphql +++ b/src/gql/queries/task.graphql @@ -46,6 +46,7 @@ query Task($taskId: String!, $execution: Int) { } details { description + diskDevices oomTracker { detected pids diff --git a/src/pages/task/metadata/Metadata.test.tsx b/src/pages/task/metadata/Metadata.test.tsx index 466b1d52ef..2fb2685a9a 100644 --- a/src/pages/task/metadata/Metadata.test.tsx +++ b/src/pages/task/metadata/Metadata.test.tsx @@ -118,6 +118,7 @@ const taskSucceeded = { oomTracker: { detected: false, }, + diskDevices: [], }, }, }; diff --git a/src/pages/task/metadata/index.tsx b/src/pages/task/metadata/index.tsx index b2cc51f6e0..ddb1bdebcb 100644 --- a/src/pages/task/metadata/index.tsx +++ b/src/pages/task/metadata/index.tsx @@ -93,6 +93,7 @@ export const Metadata: React.FC = ({ error, loading, task, taskId }) => { const { author, id: versionID } = versionMetadata ?? {}; const oomTracker = details?.oomTracker; const taskTrace = details?.traceID; + const diskDevices = details?.diskDevices; const { id: podId } = pod ?? {}; const isContainerTask = !!podId; const { metadataLinks } = annotation ?? {}; @@ -382,7 +383,12 @@ export const Metadata: React.FC = ({ error, loading, task, taskId }) => { { onHideCue(); taskAnalytics.sendEvent({ name: "Click Trace Metrics Link" });