1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-18 01:18:23 +02:00

fix: disable networkView for dev, fail more gracefully (#2701)

Disables networkView for dev for now. Attempts to fail more gracefully
both on the service and front-end.
This commit is contained in:
Nuno Góis 2022-12-15 10:12:02 +00:00 committed by GitHub
parent dc8a369b7b
commit 90f0d665f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 11 deletions

View File

@ -26,12 +26,13 @@ import theme from '../../../themes/theme';
import { formatDateHM } from '../../../utils/formatDate'; import { formatDateHM } from '../../../utils/formatDate';
import { RequestsPerSecondSchema } from 'openapi'; import { RequestsPerSecondSchema } from 'openapi';
import 'chartjs-adapter-date-fns'; import 'chartjs-adapter-date-fns';
import { PaletteColor } from '@mui/material'; import { Alert, PaletteColor } from '@mui/material';
import { PageContent } from '../../common/PageContent/PageContent'; import { PageContent } from '../../common/PageContent/PageContent';
import { PageHeader } from '../../common/PageHeader/PageHeader'; import { PageHeader } from '../../common/PageHeader/PageHeader';
import { Box } from '@mui/system'; import { Box } from '@mui/system';
import { current } from 'immer'; import { current } from 'immer';
import { CyclicIterator } from 'utils/cyclicIterator'; import { CyclicIterator } from 'utils/cyclicIterator';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
interface IPoint { interface IPoint {
x: number; x: number;
y: number; y: number;
@ -184,15 +185,21 @@ export const InstanceMetricsChart: VFC = () => {
return ( return (
<PageContent header={<PageHeader title="Requests per second" />}> <PageContent header={<PageHeader title="Requests per second" />}>
<Box sx={{ display: 'grid', gap: 4 }}> <ConditionallyRender
<div style={{ height: 400 }}> condition={data.datasets.length === 0}
<Line show={<Alert severity="warning">No data available.</Alert>}
data={data} elseShow={
options={options} <Box sx={{ display: 'grid', gap: 4 }}>
aria-label="An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API" <div style={{ height: 400 }}>
/> <Line
</div> data={data}
</Box> options={options}
aria-label="An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"
/>
</div>
</Box>
}
/>
</PageContent> </PageContent>
); );
}; };

View File

@ -225,6 +225,10 @@ export default class ClientInstanceService {
} }
async getRPSForPath(path: string, hoursToQuery: number): Promise<any> { async getRPSForPath(path: string, hoursToQuery: number): Promise<any> {
if (!this.prometheusApi) {
this.logger.warn('Prometheus not configured');
return;
}
const timeoutSeconds = 5; const timeoutSeconds = 5;
const basePath = this.serverOption.baseUriPath; const basePath = this.serverOption.baseUriPath;
const compositePath = `${basePath}/${path}`.replaceAll('//', '/'); const compositePath = `${basePath}/${path}`.replaceAll('//', '/');

View File

@ -42,7 +42,6 @@ process.nextTick(async () => {
changeRequests: true, changeRequests: true,
favorites: true, favorites: true,
variantsPerEnvironment: true, variantsPerEnvironment: true,
networkView: true,
}, },
}, },
authentication: { authentication: {