提交 34516e9b8f510801f7ed656538fb73ebcae5040d

作者 qianyingz
1 个父辈 27524217

补充提交

正在显示 1 个修改的文件 包含 21 行增加19 行删除
@@ -48,8 +48,8 @@ def pull_metric(): @@ -48,8 +48,8 @@ def pull_metric():
48 continue 48 continue
49 49
50 type_list = ["cpu_per", "memory_per", "disk_per", 50 type_list = ["cpu_per", "memory_per", "disk_per",
51 - "disk_read", "disk_write","disk_read_count",  
52 - "disk_write_count","network_send","network_recv"] 51 + "disk_read", "disk_write", "disk_read_count",
  52 + "disk_write_count", "network_send", "network_recv"]
53 for type in type_list: 53 for type in type_list:
54 sample_data = get_sample_data( 54 sample_data = get_sample_data(
55 metric_data, type, host_name) 55 metric_data, type, host_name)
@@ -88,28 +88,30 @@ def start_schedule(): @@ -88,28 +88,30 @@ def start_schedule():
88 def get_sample_data(orginal, name, host): 88 def get_sample_data(orginal, name, host):
89 res = [] 89 res = []
90 size = len(orginal) 90 size = len(orginal)
91 - orginal_stamp = {'head': 1, 'tail': size} 91 + # orginal_stamp = {'head': 1, 'tail': size}
92 if size > 1: 92 if size > 1:
93 - stamp = {'P0': 1,  
94 - 'P50': math.floor(0.5*size),  
95 - 'P90': math.floor(0.9*size),  
96 - 'P95': math.floor(0.95*size),  
97 - # 'P99': math.floor(0.99*size),  
98 - 'P100': size} 93 + stamp = {
  94 + # 'P0': 1,
  95 + 'P50': math.floor(0.5*size),
  96 + # 'P90': math.floor(0.9*size),
  97 + 'P95': math.floor(0.95*size),
  98 + # 'P99': math.floor(0.99*size),
  99 + 'P100': size}
99 elif size == 1: 100 elif size == 1:
100 - stamp = {'P0': 1,  
101 - 'P50': size,  
102 - 'P90': size,  
103 - 'P95': size,  
104 - # 'P99': size,  
105 - 'P100': size} 101 + stamp = {
  102 + # 'P0': 1,
  103 + 'P50': size,
  104 + # 'P90': size,
  105 + 'P95': size,
  106 + # 'P99': size,
  107 + 'P100': size}
106 else: 108 else:
107 return res 109 return res
108 110
109 - for key in dict.keys(orginal_stamp):  
110 - cur_data = orginal[orginal_stamp[key]-1]  
111 - info = get_data(key, host, name, cur_data)  
112 - res.append(info) 111 + # for key in dict.keys(orginal_stamp):
  112 + # cur_data = orginal[orginal_stamp[key]-1]
  113 + # info = get_data(key, host, name, cur_data)
  114 + # res.append(info)
113 115
114 data = sorted(orginal, key=lambda x: x[name]) 116 data = sorted(orginal, key=lambda x: x[name])
115 for key in dict.keys(stamp): 117 for key in dict.keys(stamp):
注册登录 后发表评论