forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opendatahub-io#2755 from mturley/v2.22.0-backport-…
…pr-2754 [v2.22.0] [RHOAIENG-6519] DW: Support workloads owned by either a RayCluster or a Job when querying CPU and Memory usage
- Loading branch information
Showing
8 changed files
with
240 additions
and
127 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
frontend/src/__mocks__/mockDWUsageByOwnerPrometheusResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { WorkloadMetricIndexedByOwner, WorkloadMetricPromQueryResponse } from '~/api'; | ||
import { WorkloadOwnerType } from '~/k8sTypes'; | ||
import { mockPrometheusQueryVectorResponse } from './mockPrometheusQueryVectorResponse'; | ||
|
||
export const mockDWUsageByOwnerPrometheusResponse = ( | ||
usageByOwner: WorkloadMetricIndexedByOwner, | ||
): WorkloadMetricPromQueryResponse => | ||
mockPrometheusQueryVectorResponse({ | ||
result: Object.values(WorkloadOwnerType).flatMap((ownerKind) => | ||
Object.keys(usageByOwner[ownerKind]).map((ownerName) => ({ | ||
// eslint-disable-next-line camelcase | ||
metric: { owner_kind: ownerKind, owner_name: ownerName }, | ||
value: [0, String(usageByOwner[ownerKind][ownerName])], | ||
})), | ||
), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.