Skip to content

Commit

Permalink
fix: round properly
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed May 20, 2024
1 parent 3935f93 commit a886bb9
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions vue/src/tracing/views/OverviewServiceGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</template>
<tr>
<th>Calls per min</th>
<td><NumValue :value="activeItem.rate" format="verbose" /></td>
<td><NumValue :value="activeItem.rate" verbosity="max" /></td>
</tr>
<tr>
<th>Err. rate</th>
Expand Down Expand Up @@ -231,9 +231,14 @@ import ServiceGraphHelpCard from '@/tracing/ServiceGraphHelpCard.vue'
// Misc
import { SystemName, AttrKey } from '@/models/otel'
import { MINUTE } from '@/util/fmt/date'
import { quote } from '@/util/string'
interface Item {
text: string
value: string
count: number
}
export default defineComponent({
name: 'OverviewServiceGraph',
components: { ServiceGraphChart, ServiceGraphHelpDialog, ServiceGraphHelpCard },
Expand Down Expand Up @@ -276,23 +281,23 @@ export default defineComponent({
})
const activeEdgeTypes = shallowRef<string[]>([])
const edgeTypeItems = computed(() => {
const edgeTypeItems = computed((): Item[] => {
const map = new Map<string, number>()
for (let edge of serviceGraph.edges) {
const count = map.get(edge.type) ?? 0
map.set(edge.type, count + 1)
}
const items = []
const items: Item[] = []
for (let [key, value] of map) {
map.forEach((value, key) => {
items.push({
text: key,
value: key,
count: value,
})
}
})
return items
})
Expand Down Expand Up @@ -389,7 +394,7 @@ export default defineComponent({
})
const maxErrorRate = computed(() => {
const prec = 1 / errorRateStep.value
return Math.round((_maxErrorRate.value + Number.EPSILON) * prec) / prec
return Math.ceil((_maxErrorRate.value + Number.EPSILON) * prec) / prec
})
watch(
() => [minErrorRate.value, maxErrorRate.value],
Expand Down Expand Up @@ -575,7 +580,6 @@ export default defineComponent({
metric: metricName,
alias: metricAlias,
query,
time_offset: String(10 * MINUTE),
},
},
}
Expand Down

0 comments on commit a886bb9

Please sign in to comment.