feat: add a calculation to convert nanoseconds to milliseconds (#148)

This commit is contained in:
Fine0830 2022-08-26 16:26:25 +08:00 committed by GitHub
parent 42b20660e4
commit 82b348a766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -37,6 +37,7 @@ export enum Calculations {
PercentageAvg = "percentageAvg", PercentageAvg = "percentageAvg",
ApdexAvg = "apdexAvg", ApdexAvg = "apdexAvg",
SecondToDay = "secondToDay", SecondToDay = "secondToDay",
NanosecondToMillisecond = "nanosecondToMillisecond",
} }
export enum sizeEnum { export enum sizeEnum {
XS = "XS", XS = "XS",

View File

@ -397,7 +397,7 @@ export function aggregation(
data = (val / 1024 / 1024 / 1024).toFixed(2); data = (val / 1024 / 1024 / 1024).toFixed(2);
break; break;
case Calculations.Apdex: case Calculations.Apdex:
data = val / 10000; data = (val / 10000).toFixed(2);
break; break;
case Calculations.ConvertSeconds: case Calculations.ConvertSeconds:
data = dayjs(val * 1000).format("YYYY-MM-DD HH:mm:ss"); data = dayjs(val * 1000).format("YYYY-MM-DD HH:mm:ss");
@ -414,6 +414,9 @@ export function aggregation(
case Calculations.SecondToDay: case Calculations.SecondToDay:
data = (val / 86400).toFixed(2); data = (val / 86400).toFixed(2);
break; break;
case Calculations.NanosecondToMillisecond:
data = (val / 1000 / 1000).toFixed(2);
break;
default: default:
data; data;
break; break;

View File

@ -297,4 +297,5 @@ export const CalculationOpts = [
{ label: "Precision is 2", value: "precision" }, { label: "Precision is 2", value: "precision" },
{ label: "Milliseconds to seconds", value: "msTos" }, { label: "Milliseconds to seconds", value: "msTos" },
{ label: "Seconds to days", value: "secondToDay" }, { label: "Seconds to days", value: "secondToDay" },
{ label: "Nanoseconds to milliseconds", value: "nanosecondToMillisecond" },
]; ];