You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by qi...@apache.org on 2022/08/26 08:26:30 UTC

[skywalking-booster-ui] branch main updated: feat: add a calculation to convert nanoseconds to milliseconds (#148)

This is an automated email from the ASF dual-hosted git repository.

qiuxiafan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new 82b348a  feat: add a calculation to convert nanoseconds to milliseconds (#148)
82b348a is described below

commit 82b348a76674292ba42ac4ad4ff0090dfd415f60
Author: Fine0830 <fa...@gmail.com>
AuthorDate: Fri Aug 26 16:26:25 2022 +0800

    feat: add a calculation to convert nanoseconds to milliseconds (#148)
---
 src/hooks/data.ts           | 1 +
 src/hooks/useProcessor.ts   | 5 ++++-
 src/views/dashboard/data.ts | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/hooks/data.ts b/src/hooks/data.ts
index 73eef8d..1656122 100644
--- a/src/hooks/data.ts
+++ b/src/hooks/data.ts
@@ -37,6 +37,7 @@ export enum Calculations {
   PercentageAvg = "percentageAvg",
   ApdexAvg = "apdexAvg",
   SecondToDay = "secondToDay",
+  NanosecondToMillisecond = "nanosecondToMillisecond",
 }
 export enum sizeEnum {
   XS = "XS",
diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts
index dea2518..55f2edc 100644
--- a/src/hooks/useProcessor.ts
+++ b/src/hooks/useProcessor.ts
@@ -397,7 +397,7 @@ export function aggregation(
       data = (val / 1024 / 1024 / 1024).toFixed(2);
       break;
     case Calculations.Apdex:
-      data = val / 10000;
+      data = (val / 10000).toFixed(2);
       break;
     case Calculations.ConvertSeconds:
       data = dayjs(val * 1000).format("YYYY-MM-DD HH:mm:ss");
@@ -414,6 +414,9 @@ export function aggregation(
     case Calculations.SecondToDay:
       data = (val / 86400).toFixed(2);
       break;
+    case Calculations.NanosecondToMillisecond:
+      data = (val / 1000 / 1000).toFixed(2);
+      break;
     default:
       data;
       break;
diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts
index e79af1c..78536e3 100644
--- a/src/views/dashboard/data.ts
+++ b/src/views/dashboard/data.ts
@@ -297,4 +297,5 @@ export const CalculationOpts = [
   { label: "Precision is 2", value: "precision" },
   { label: "Milliseconds to seconds", value: "msTos" },
   { label: "Seconds to days", value: "secondToDay" },
+  { label: "Nanoseconds to milliseconds", value: "nanosecondToMillisecond" },
 ];