-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RHOAIENG-6522] Create model metrics kserve page
- Loading branch information
1 parent
23ae524
commit bc32c9d
Showing
9 changed files
with
175 additions
and
60 deletions.
There are no files selected for viewing
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
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,37 @@ | ||
import React from 'react'; | ||
import { | ||
EmptyState, | ||
EmptyStateVariant, | ||
EmptyStateIcon, | ||
EmptyStateBody, | ||
PageSection, | ||
PageSectionVariants, | ||
EmptyStateHeader, | ||
} from '@patternfly/react-core'; | ||
import { ErrorCircleOIcon } from '@patternfly/react-icons'; | ||
|
||
type UnauthorizedErrorProps = { | ||
variant?: PageSectionVariants; | ||
titleText: string; | ||
error: Error; | ||
testId?: string; | ||
}; | ||
const UnknownError: React.FC<UnauthorizedErrorProps> = ({ | ||
variant = PageSectionVariants.default, | ||
titleText, | ||
error, | ||
testId, | ||
}) => ( | ||
<PageSection isFilled variant={variant} data-testid={testId}> | ||
<EmptyState variant={EmptyStateVariant.lg}> | ||
<EmptyStateHeader | ||
titleText={titleText} | ||
icon={<EmptyStateIcon icon={ErrorCircleOIcon} />} | ||
headingLevel="h5" | ||
/> | ||
<EmptyStateBody>{error.message}</EmptyStateBody> | ||
</EmptyState> | ||
</PageSection> | ||
); | ||
|
||
export default UnknownError; |
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
22 changes: 22 additions & 0 deletions
22
frontend/src/pages/modelServing/screens/metrics/performance/KserveMetrics.tsx
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,22 @@ | ||
import * as React from 'react'; | ||
import { Stack, StackItem } from '@patternfly/react-core'; | ||
import MetricsPlaceHolder from '~/pages/modelServing/screens/metrics/performance/MetricsPlaceHolder'; | ||
|
||
const KserveMetrics: React.FC = () => ( | ||
<Stack hasGutter> | ||
<StackItem> | ||
<MetricsPlaceHolder title="HTTP requests per 5 minutes" /> | ||
</StackItem> | ||
<StackItem> | ||
<MetricsPlaceHolder title="Average response time (ms)" /> | ||
</StackItem> | ||
<StackItem> | ||
<MetricsPlaceHolder title="CPU utilization %" /> | ||
</StackItem> | ||
<StackItem> | ||
<MetricsPlaceHolder title="Memory utilization %" /> | ||
</StackItem> | ||
</Stack> | ||
); | ||
|
||
export default KserveMetrics; |
32 changes: 32 additions & 0 deletions
32
frontend/src/pages/modelServing/screens/metrics/performance/MetricsPlaceHolder.tsx
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,32 @@ | ||
import * as React from 'react'; | ||
import { | ||
Card, | ||
CardBody, | ||
CardHeader, | ||
CardTitle, | ||
EmptyState, | ||
EmptyStateIcon, | ||
Title, | ||
} from '@patternfly/react-core'; | ||
import { CubesIcon } from '@patternfly/react-icons'; | ||
|
||
type MetricsPlaceHolderProps = { | ||
title: string; | ||
}; | ||
const MetricsPlaceHolder: React.FC<MetricsPlaceHolderProps> = ({ title }) => ( | ||
<Card data-testid={`metrics-card-${title}`}> | ||
<CardHeader> | ||
<CardTitle>{title}</CardTitle> | ||
</CardHeader> | ||
<CardBody style={{ height: 200, padding: 0 }}> | ||
<EmptyState> | ||
<EmptyStateIcon icon={CubesIcon} /> | ||
<Title headingLevel="h4" size="lg" data-testid="metrics-chart-place-holder"> | ||
Metrics coming soon | ||
</Title> | ||
</EmptyState> | ||
</CardBody> | ||
</Card> | ||
); | ||
|
||
export default MetricsPlaceHolder; |
44 changes: 9 additions & 35 deletions
44
frontend/src/pages/modelServing/screens/metrics/performance/ModelGraphs.tsx
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 |
---|---|---|
@@ -1,40 +1,14 @@ | ||
import * as React from 'react'; | ||
import { Stack, StackItem } from '@patternfly/react-core'; | ||
import MetricsChart from '~/pages/modelServing/screens/metrics/MetricsChart'; | ||
import { | ||
ModelMetricType, | ||
ModelServingMetricsContext, | ||
} from '~/pages/modelServing/screens/metrics/ModelServingMetricsContext'; | ||
import { ContextResourceData, PrometheusQueryRangeResultValue } from '~/types'; | ||
import { InferenceServiceKind } from '~/k8sTypes'; | ||
import { isModelMesh } from '~/pages/modelServing/utils'; | ||
import ModelMeshMetrics from '~/pages/modelServing/screens/metrics/performance/ModelMeshMetrics'; | ||
import KserveMetrics from '~/pages/modelServing/screens/metrics/performance/KserveMetrics'; | ||
|
||
const ModelGraphs: React.FC = () => { | ||
const { data } = React.useContext(ModelServingMetricsContext); | ||
|
||
return ( | ||
<Stack hasGutter> | ||
<StackItem> | ||
<MetricsChart | ||
metrics={[ | ||
{ | ||
name: 'Successful', | ||
metric: data[ | ||
ModelMetricType.REQUEST_COUNT_SUCCESS | ||
] as ContextResourceData<PrometheusQueryRangeResultValue>, | ||
}, | ||
{ | ||
name: 'Failed', | ||
metric: data[ | ||
ModelMetricType.REQUEST_COUNT_FAILED | ||
] as ContextResourceData<PrometheusQueryRangeResultValue>, | ||
}, | ||
]} | ||
color="blue" | ||
title="HTTP requests per 5 minutes" | ||
isStack | ||
/> | ||
</StackItem> | ||
</Stack> | ||
); | ||
type ModelGraphProps = { | ||
model: InferenceServiceKind; | ||
}; | ||
|
||
const ModelGraphs: React.FC<ModelGraphProps> = ({ model }) => | ||
isModelMesh(model) ? <ModelMeshMetrics /> : <KserveMetrics />; | ||
|
||
export default ModelGraphs; |
46 changes: 46 additions & 0 deletions
46
frontend/src/pages/modelServing/screens/metrics/performance/ModelMeshMetrics.tsx
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,46 @@ | ||
import * as React from 'react'; | ||
import { Stack, StackItem } from '@patternfly/react-core'; | ||
import MetricsChart from '~/pages/modelServing/screens/metrics/MetricsChart'; | ||
import { | ||
ModelMetricType, | ||
ModelServingMetricsContext, | ||
} from '~/pages/modelServing/screens/metrics/ModelServingMetricsContext'; | ||
import { ContextResourceData, PrometheusQueryRangeResultValue } from '~/types'; | ||
import EnsureMetricsAvailable from '~/pages/modelServing/screens/metrics/EnsureMetricsAvailable'; | ||
|
||
const ModelMeshMetrics: React.FC = () => { | ||
const { data } = React.useContext(ModelServingMetricsContext); | ||
|
||
return ( | ||
<Stack hasGutter> | ||
<EnsureMetricsAvailable | ||
metrics={[ModelMetricType.REQUEST_COUNT_SUCCESS, ModelMetricType.REQUEST_COUNT_FAILED]} | ||
accessDomain="model metrics" | ||
> | ||
<StackItem> | ||
<MetricsChart | ||
metrics={[ | ||
{ | ||
name: 'Successful', | ||
metric: data[ | ||
ModelMetricType.REQUEST_COUNT_SUCCESS | ||
] as ContextResourceData<PrometheusQueryRangeResultValue>, | ||
}, | ||
{ | ||
name: 'Failed', | ||
metric: data[ | ||
ModelMetricType.REQUEST_COUNT_FAILED | ||
] as ContextResourceData<PrometheusQueryRangeResultValue>, | ||
}, | ||
]} | ||
color="blue" | ||
title="HTTP requests per 5 minutes" | ||
isStack | ||
/> | ||
</StackItem> | ||
</EnsureMetricsAvailable> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default ModelMeshMetrics; |
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