import React, { FC } from 'react'; import { RouteComponentProps } from '@reach/router'; import { Table } from 'reactstrap'; import { useFetch } from '../../hooks/useFetch'; import PathPrefixProps from '../../types/PathPrefixProps'; import { withStatusIndicator } from '../../components/withStatusIndicator'; interface Stats { name: string; value: number; } export interface TSDBMap { seriesCountByMetricName: Stats[]; labelValueCountByLabelName: Stats[]; memoryInBytesByLabelName: Stats[]; seriesCountByLabelValuePair: Stats[]; } export const TSDBStatusContent: FC = ({ labelValueCountByLabelName, seriesCountByMetricName, memoryInBytesByLabelName, seriesCountByLabelValuePair, }) => { return (

TSDB Status

Head Cardinality Stats

{[ { title: 'Top 10 label names with value count', stats: labelValueCountByLabelName }, { title: 'Top 10 series count by metric names', stats: seriesCountByMetricName }, { title: 'Top 10 label names with high memory usage', unit: 'Bytes', stats: memoryInBytesByLabelName }, { title: 'Top 10 series count by label value pairs', stats: seriesCountByLabelValuePair }, ].map(({ title, unit = 'Count', stats }) => { return (

{title}

{stats.map(({ name, value }) => { return ( ); })}
Name {unit}
{name} {value}
); })}
); }; TSDBStatusContent.displayName = 'TSDBStatusContent'; const TSDBStatusContentWithStatusIndicator = withStatusIndicator(TSDBStatusContent); const TSDBStatus: FC = ({ pathPrefix }) => { const { response, error, isLoading } = useFetch(`${pathPrefix}/api/v1/status/tsdb`); return ( ); }; export default TSDBStatus;