UI: Handle histograms without buckets

Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
beorn7 2022-05-04 16:30:36 +02:00
parent 654c07783c
commit c9f9ff9aa8
2 changed files with 7 additions and 5 deletions

View file

@ -169,10 +169,12 @@ export const HistogramString: FC<HistogramStringProps> = ({ h }) => {
} }
const buckets: string[] = []; const buckets: string[] = [];
for (const bucket of h.buckets) { if (h.buckets) {
const left = bucket[0] === 3 || bucket[0] === 1 ? '[' : '('; for (const bucket of h.buckets) {
const right = bucket[0] === 3 || bucket[0] === 0 ? ']' : ')'; const left = bucket[0] === 3 || bucket[0] === 1 ? '[' : '(';
buckets.push(left + bucket[1] + ',' + bucket[2] + right + ':' + bucket[3] + ' '); const right = bucket[0] === 3 || bucket[0] === 0 ? ']' : ')';
buckets.push(left + bucket[1] + ',' + bucket[2] + right + ':' + bucket[3] + ' ');
}
} }
return ( return (

View file

@ -7,7 +7,7 @@ export interface Metric {
export interface Histogram { export interface Histogram {
count: string; count: string;
sum: string; sum: string;
buckets: [number, string, string, string][]; buckets?: [number, string, string, string][];
} }
export interface Exemplar { export interface Exemplar {