@cryptotaxi247 / netdata-1 / commits / cad2d0f5a

Change sum operation mode and add @staticmethod decorator

Luis Eduardo committed Jan 27, 2018 at 10:16 UTC cad2d0f5a1b6c60f5623fa59fe20b06c44d03cc2
1 file changed +16 -11
python.d/ceph.chart.py
+16 -11
@@ -206,13 +206,13 @@ class Service(SimpleService):
206 commit_latency = 0
207
208 for pool_rw_io_b in pool_stats:
209 - read_bytes_sec = read_bytes_sec + pool_rw_io_b['client_io_rate'].get('read_bytes_sec', 0)
210 - write_bytes_sec = write_bytes_sec + pool_rw_io_b['client_io_rate'].get('write_bytes_sec', 0)
211 - read_op_per_sec = read_op_per_sec + pool_rw_io_b['client_io_rate'].get('read_op_per_sec', 0)
212 - write_op_per_sec = write_op_per_sec + pool_rw_io_b['client_io_rate'].get('write_op_per_sec', 0)
209 + read_bytes_sec += pool_rw_io_b['client_io_rate'].get('read_bytes_sec', 0)
210 + write_bytes_sec += pool_rw_io_b['client_io_rate'].get('write_bytes_sec', 0)
211 + read_op_per_sec += pool_rw_io_b['client_io_rate'].get('read_op_per_sec', 0)
212 + write_op_per_sec += pool_rw_io_b['client_io_rate'].get('write_op_per_sec', 0)
213 for perf in osd_perf['osd_perf_infos']:
214 - apply_latency = apply_latency + perf['perf_stats']['apply_latency_ms']
215 - commit_latency = commit_latency + perf['perf_stats']['commit_latency_ms']
214 + apply_latency += perf['perf_stats']['apply_latency_ms']
215 + commit_latency += perf['perf_stats']['commit_latency_ms']
216
217 return {'general_usage': int(status['kb_used']),
218 'general_available': int(status['kb_avail']),
@@ -225,21 +225,24 @@ class Service(SimpleService):
225 'general_commit_latency': commit_latency
226 }
227
228 - def _get_pool_usage(self, pool):
228 + @staticmethod
229 + def _get_pool_usage(pool):
230 """
231 Process raw data into pool usage dict information
232 :return: A pool dict with pool name's key and usage bytes' value
233 """
234 return {pool['name']: pool['stats']['kb_used']}
235
235 - def _get_pool_objects(self, pool):
236 + @staticmethod
237 + def _get_pool_objects(pool):
238 """
239 Process raw data into pool usage dict information
240 :return: A pool dict with pool name's key and object numbers
241 """
242 return {'obj_{0}'.format(pool['name']): pool['stats']['objects']}
243
242 - def _get_pool_rw(self, pool):
244 + @staticmethod
245 + def _get_pool_rw(pool):
246 """
247 Get read/write kb and operations in a pool
248 :return: A pool dict with both read/write bytes and operations.
@@ -250,14 +253,16 @@ class Service(SimpleService):
253 'write_operations_{0}'.format(pool['pool_name']): int(pool['client_io_rate'].get('write_op_per_sec', 0))
254 }
255
253 - def _get_osd_usage(self, osd):
256 + @staticmethod
257 + def _get_osd_usage(osd):
258 """
259 Process raw data into osd dict information to get osd usage
260 :return: A osd dict with osd name's key and usage bytes' value
261 """
262 return {osd['name']: float(osd['kb_used'])}
263
260 - def _get_osd_latency(self, osd):
264 + @staticmethod
265 + def _get_osd_latency(osd):
266 """
267 Get ceph osd apply and commit latency
268 :return: A osd dict with osd name's key with both apply and commit latency values