allow fractional timings in web_log
Costa Tsaousis (ktsaou) committed
Feb 11, 2017 at 16:26 UTC
9a5d2c6e1724b5f103fd82d906afdaed7c1bb0c0
1 file changed
+9
-9
python.d/web_log.chart.py
+9
-9
@@ -39,9 +39,9 @@ CHARTS = {
39
'response_time': {
40
'options': [None, 'Processing Time', 'milliseconds', 'timings', 'web_log.response_time', 'area'],
41
'lines': [
42
- ['resp_time_min', 'min', 'absolute', 1, 1],
43
- ['resp_time_max', 'max', 'absolute', 1, 1],
44
- ['resp_time_avg', 'avg', 'absolute', 1, 1]
42
+ ['resp_time_min', 'min', 'absolute', 1, 100],
43
+ ['resp_time_max', 'max', 'absolute', 1, 100],
44
+ ['resp_time_avg', 'avg', 'absolute', 1, 100]
45
]},
46
'clients': {
47
'options': [None, 'Current Poll Unique Client IPs', 'unique ips', 'clients', 'web_log.clients', 'stacked'],
@@ -170,7 +170,7 @@ class Service(LogService):
170
r' ([\d.]+) ')
171
172
regex_function = zip([access_apache_ext, access_nginx_ext, access_default],
173
- [lambda x: x, lambda x: x * 1000, lambda x: x],
173
+ [lambda x: x, lambda x: x * 100000, lambda x: x],
174
['access_apache_ext', 'access_nginx_ext', 'access_default'])
175
regex_name = None
176
for regex, function, name in regex_function:
@@ -215,9 +215,9 @@ class Service(LogService):
215
' web_log.http_method stacked 2 %s\n' % (job_name, self.update_every)
216
217
if regex_name == 'access_apache_ext':
218
- self.definitions['response_time']['lines'][0][4] = 1000
219
- self.definitions['response_time']['lines'][1][4] = 1000
220
- self.definitions['response_time']['lines'][2][4] = 1000
218
+ self.definitions['response_time']['lines'][0][4] = 100000
219
+ self.definitions['response_time']['lines'][1][4] = 100000
220
+ self.definitions['response_time']['lines'][2][4] = 100000
221
222
# Remove 'request_time' chart from ORDER if request_time not in logs
223
if regex_name == 'access_default':
@@ -303,7 +303,7 @@ class Service(LogService):
303
# request processing time and bandwidth received
304
if match_dict['resp_length'] and match_dict['resp_time']:
305
to_netdata['resp_length'] += int(match_dict['resp_length'])
306
- resp_time = self.resp_time_func(float(match_dict['resp_time']))
306
+ resp_time = self.resp_time_func(float(match_dict['resp_time']) * 100)
307
bisect.insort_left(request_time, resp_time)
308
request_counter['count'] += 1
309
request_counter['sum'] += resp_time
@@ -322,7 +322,7 @@ class Service(LogService):
322
# timings
323
if request_time:
324
to_netdata['resp_time_min'] = request_time[0]
325
- to_netdata['resp_time_avg'] = float(request_counter['sum']) / request_counter['count']
325
+ to_netdata['resp_time_avg'] = float(request_counter['sum']) * 100 / request_counter['count']
326
to_netdata['resp_time_max'] = request_time[-1]
327
328
to_netdata.update(self.storage)