UI: Handle histograms without buckets

Signed-off-by: beorn7 <beorn@grafana.com>
pull/10851/head
beorn7 3 years ago
parent 654c07783c
commit c9f9ff9aa8

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

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

Loading…
Cancel
Save