change(ui): add more detials to health status

This commit is contained in:
nick-delirium 2023-04-28 11:48:40 +02:00
parent 3c818843c2
commit 4031ac90f5
3 changed files with 18 additions and 3 deletions

View file

@ -6,7 +6,7 @@ import HealthWidget from "Components/Header/HealthStatus/HealthWidget";
import { getHealthRequest } from './getHealth'
export interface IServiceStats {
name: 'backendServices' | 'databases' | 'ingestionPipeline' | 'ssl';
name: 'backendServices' | 'databases' | 'ingestionPipeline' | 'SSL';
serviceName: string;
healthOk: boolean;
subservices: {

View file

@ -12,7 +12,7 @@ function HealthWidget({
setShowModal,
isError,
}: {
healthResponse: { overallHealth: boolean; healthMap: Record<string, IServiceStats> };
healthResponse: { overallHealth: boolean; healthMap: Record<string, IServiceStats>, details: Record<string, any> };
getHealth: Function;
isLoading: boolean;
lastAsked: string | null;
@ -69,6 +69,10 @@ function HealthWidget({
</div>
{isError && <div className={'text-secondary text-sm'}>Error getting service health status</div>}
<div className={'w-full'}>
<div>Sessions: {healthResponse.details?.numberOfEventCaptured.toLocaleString()}</div>
<div>Events: {healthResponse.details?.numberOfSessionsCaptured.toLocaleString()}</div>
</div>
<div className={'w-full'}>
{!isError && !healthOk ? (
<>

View file

@ -7,6 +7,17 @@ function mapResponse(resp: Record<string, any>) {
const services = Object.keys(resp);
const healthMap: Record<string, IServiceStats> = {};
services.forEach((service) => {
if (service === 'details') return;
if (service === 'ssl') {
healthMap[service] = {
name: categoryKeyNames[service],
healthOk: resp[service].health,
serviceName: service,
// @ts-ignore
subservices: { ssl: resp[service] }
};
return;
}
healthMap[service] = {
// @ts-ignore
name: categoryKeyNames[service],
@ -23,7 +34,7 @@ function mapResponse(resp: Record<string, any>) {
(service: Record<string, any>) => service.healthOk
);
return { overallHealth, healthMap };
return { overallHealth, healthMap, details: resp.details };
}
export async function getHealthRequest(isPublic?: boolean) {