mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 13:29:02 +08:00
fixes edge case
This commit is contained in:
parent
2d646c0655
commit
45375fbd53
@ -2,11 +2,11 @@ import { uniqBy, uniq, maxBy, cloneDeep, find } from "lodash";
|
|||||||
import { serviceMapStore } from "Src/store/actions";
|
import { serviceMapStore } from "Src/store/actions";
|
||||||
import { graphDataType } from "./ServiceMap";
|
import { graphDataType } from "./ServiceMap";
|
||||||
|
|
||||||
|
const MAX_WIDTH = 8;
|
||||||
|
const MIN_WIDTH = 5;
|
||||||
|
const MAX_FONT_SIZE = 8;
|
||||||
|
const MIN_FONT_SIZE = 5;
|
||||||
export const getDimensions = (num, highest) => {
|
export const getDimensions = (num, highest) => {
|
||||||
const MAX_WIDTH = 8;
|
|
||||||
const MIN_WIDTH = 5;
|
|
||||||
const MAX_FONT_SIZE = 8;
|
|
||||||
const MIN_FONT_SIZE = 5;
|
|
||||||
const percentage = (num / highest) * 100;
|
const percentage = (num / highest) * 100;
|
||||||
const width = (percentage * (MAX_WIDTH - MIN_WIDTH)) / 100 + MIN_WIDTH;
|
const width = (percentage * (MAX_WIDTH - MIN_WIDTH)) / 100 + MIN_WIDTH;
|
||||||
const fontSize =
|
const fontSize =
|
||||||
@ -39,6 +39,19 @@ export const getGraphData = (serviceMap: serviceMapStore): graphDataType => {
|
|||||||
const nodes = uniqNodes.map((node, i) => {
|
const nodes = uniqNodes.map((node, i) => {
|
||||||
const service = find(services, (service) => service.serviceName === node);
|
const service = find(services, (service) => service.serviceName === node);
|
||||||
let color = "#84ff00";
|
let color = "#84ff00";
|
||||||
|
if (!service) {
|
||||||
|
return {
|
||||||
|
id: node,
|
||||||
|
group: i + 1,
|
||||||
|
fontSize: MIN_FONT_SIZE,
|
||||||
|
width: MIN_WIDTH,
|
||||||
|
color,
|
||||||
|
nodeVal: MIN_WIDTH,
|
||||||
|
callRate: 0,
|
||||||
|
errorRate: 0,
|
||||||
|
p99: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
if (service.errorRate > 0) {
|
if (service.errorRate > 0) {
|
||||||
color = "#f00a0a";
|
color = "#f00a0a";
|
||||||
} else if (service.fourXXRate > 0) {
|
} else if (service.fourXXRate > 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user