Skip to content

Commit

Permalink
Fix empty stacked bar chart for topN hosts
Browse files Browse the repository at this point in the history
When grouping items into top N buckets, we relied on the existence of
two keys (key and key_as_string) to provide the topN value to the chart.

If "key" was a string type, then we returned the value of
"key_as_string". Otherwise, we returned the value of "key".

However, this assumption no longer applies. The HostID value is an
unsigned long, but only is available in "key" and the "key_as_string"
does not exist.
  • Loading branch information
jbcrail committed Feb 12, 2022
1 parent a3f9381 commit 7c51952
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/plugins/profiling/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ export function getTopN(obj) {
const bucket = obj.topN.histogram.buckets[i];
for (let j = 0; j < bucket.group_by.buckets.length; j++) {
const v = bucket.group_by.buckets[j];
if (typeof v.key === 'string') {
data.push({ x: bucket.key, y: v.Count.value, g: v.key });
} else {
data.push({ x: bucket.key, y: v.Count.value, g: v.key_as_string });
}
data.push({ x: bucket.key, y: v.Count.value, g: v.key });
}
}
} else if (obj.TopN !== undefined) {
Expand Down

0 comments on commit 7c51952

Please sign in to comment.