Procházet zdrojové kódy

监控数据的时间戳设计为60的整倍数

James Iter před 9 roky
rodič
revize
2684d841fa
2 změnil soubory, kde provedl 5 přidání a 6 odebrání
  1. 2 1
      models/event_processor.py
  2. 3 5
      models/performance.py

+ 2 - 1
models/event_processor.py

@@ -210,7 +210,8 @@ class EventProcessor(object):
     @classmethod
     def collection_performance_processor(cls):
         data_kind = cls.message['type']
-        timestamp = cls.message['timestamp']
+        timestamp = ji.Common.ts()
+        timestamp -= (timestamp % 60)
         data = cls.message['message']['data']
 
         if data_kind == CollectionPerformanceDataKind.cpu_memory.value:

+ 3 - 5
models/performance.py

@@ -2,8 +2,6 @@
 # -*- coding: utf-8 -*-
 
 
-import jimit as ji
-
 from models import ORM, FilterFieldType
 
 
@@ -25,7 +23,7 @@ class CPUMemory(ORM):
         self.cpu_load = None
         self.memory_available = None
         self.memory_unused = None
-        self.timestamp = ji.Common.tus()
+        self.timestamp = None
 
     @staticmethod
     def get_filter_keywords():
@@ -63,7 +61,7 @@ class Traffic(ORM):
         self.tx_packets = None
         self.tx_errs = None
         self.tx_drop = None
-        self.timestamp = ji.Common.tus()
+        self.timestamp = None
 
     @staticmethod
     def get_filter_keywords():
@@ -100,7 +98,7 @@ class DiskIO(ORM):
         self.rd_bytes = None
         self.wr_req = None
         self.wr_bytes = None
-        self.timestamp = ji.Common.tus()
+        self.timestamp = None
 
     @staticmethod
     def get_filter_keywords():