ソースを参照

[release] v0.12.0-unstable10

Yann Stepienik 1 年間 前
コミット
379c574358

+ 0 - 1
client/src/api/config.demo.ts

@@ -1,4 +1,3 @@
-import { resolve } from 'eslint-import-resolver-typescript';
 import configDemo from './demo.config.json';
 
 interface Route {

+ 2 - 0
client/src/api/index.jsx

@@ -13,6 +13,7 @@ import * as dockerDemo from './docker.demo';
 import * as indexDemo from './index.demo';
 import * as marketDemo from './market.demo';
 import * as constellationDemo from './constellation.demo';
+import * as metricsDemo from './metrics.demo';
 
 import wrap from './wrap';
 import { redirectToLocal } from '../utils/indexs';
@@ -230,6 +231,7 @@ if(isDemo) {
   getDNS = indexDemo.getDNS;
   uploadBackground = indexDemo.uploadBackground;
   constellation = constellationDemo;
+  metrics = metricsDemo;
 }
 
 export {

ファイルの差分が大きいため隠しています
+ 0 - 0
client/src/api/metrics.demo.json


+ 11 - 0
client/src/api/metrics.demo.jsx

@@ -0,0 +1,11 @@
+import metricsDemo from './metrics.demo.json';
+
+function get() {
+  return new Promise((resolve, reject) => {
+    resolve(metricsDemo)
+  });
+}
+
+export {
+  get,
+};

+ 2 - 0
client/src/pages/dashboard/components/plot.jsx

@@ -147,6 +147,8 @@ const PlotComponent = ({ title, data, defaultSlot = 'latest' }) => {
           },
           
           formatter: (num) => {
+            if(!num) return 0;
+            
             if (Math.abs(num) >= 1e12) {
               return (num / 1e12).toFixed(1) + 'T'; // Convert to Millions
             } else if (Math.abs(num) >= 1e9) {

+ 2 - 0
client/src/pages/dashboard/components/table.jsx

@@ -73,6 +73,8 @@ function stableSort(array, comparator) {
 }
 
 function formatter(num) {
+  if(!num) return 0;
+  
   if (Math.abs(num) >= 1e12) {
     return (num / 1e12).toFixed(1) + 'T'; // Convert to Millions
   } else if (Math.abs(num) >= 1e9) {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "cosmos-server",
-  "version": "0.12.0-unstable9",
+  "version": "0.12.0-unstable10",
   "description": "",
   "main": "test-server.js",
   "bugs": {

+ 4 - 4
src/metrics/system.go

@@ -82,10 +82,10 @@ func GetSystemMetrics() {
 	// Get Network Usage
 	netIO, err := net.IOCountersWithContext(ctx, false)
 	
-	// netIOTest, _ := net.IOCounters(true)
-	// for _, v := range netIOTest {
-	// 	utils.Debug("Metrics - Network " + v.Name + " : " + strconv.Itoa(int(v.BytesRecv)) + " / " + strconv.Itoa(int(v.BytesSent)) + " / " + strconv.Itoa(int(v.Errin + v.Errout)) + " / " + strconv.Itoa(int(v.Dropin + v.Dropout)))
-	// }
+	netIOTest, _ := net.IOCounters(true)
+	for _, v := range netIOTest {
+		utils.Debug("Metrics - Network " + v.Name + " : " + strconv.Itoa(int(v.BytesRecv)) + " / " + strconv.Itoa(int(v.BytesSent)) + " / " + strconv.Itoa(int(v.Errin + v.Errout)) + " / " + strconv.Itoa(int(v.Dropin + v.Dropout)))
+	}
 
 	PushSetMetric("system.netRx", int(netIO[0].BytesRecv), DataDef{
 		Max: 0,

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません