]> arthur.barton.de Git - netdata.git/commitdiff
high resolution web_log timings
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Feb 2017 14:48:41 +0000 (16:48 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Sat, 11 Feb 2017 14:48:41 +0000 (16:48 +0200)
python.d/web_log.chart.py

index 391d4468521f356033cc16284c8228261dd67f5c..042b575469e9f76d38a1a5a0a8e1e9fc5fbaf482 100644 (file)
@@ -39,9 +39,9 @@ CHARTS = {
     'response_time': {
         'options': [None, 'Processing Time', 'milliseconds', 'timings', 'web_log.response_time', 'area'],
         'lines': [
-            ['resp_time_min', 'min', 'absolute', 1, 1],
-            ['resp_time_max', 'max', 'absolute', 1, 1],
-            ['resp_time_avg', 'avg', 'absolute', 1, 1]
+            ['resp_time_min', 'min', 'absolute', 1, 1000],
+            ['resp_time_max', 'max', 'absolute', 1, 1000],
+            ['resp_time_avg', 'avg', 'absolute', 1, 1000]
         ]},
     'clients': {
         'options': [None, 'Current Poll Unique Client IPs', 'unique ips', 'clients', 'web_log.clients', 'stacked'],
@@ -170,7 +170,7 @@ class Service(LogService):
                                       r' ([\d.]+) ')
 
         regex_function = zip([access_apache_ext, access_nginx_ext, access_default],
-                             [lambda x: x, lambda x: x * 1000, lambda x: x],
+                             [lambda x: x, lambda x: x * 1000000, lambda x: x],
                              ['access_apache_ext', 'access_nginx_ext', 'access_default'])
         regex_name = None
         for regex, function, name in regex_function:
@@ -214,11 +214,6 @@ class Service(LogService):
                                  ' "" "Requests Per HTTP Method" requests/s "http methods"' \
                                  ' web_log.http_method stacked 2 %s\n' % (job_name, self.update_every)
 
-        if regex_name == 'access_apache_ext':
-            self.definitions['response_time']['lines'][0][4] = 1000
-            self.definitions['response_time']['lines'][1][4] = 1000
-            self.definitions['response_time']['lines'][2][4] = 1000
-
         # Remove 'request_time' chart from ORDER if request_time not in logs
         if regex_name == 'access_default':
             self.order.remove('response_time')
@@ -322,7 +317,7 @@ class Service(LogService):
         # timings
         if request_time:
             to_netdata['resp_time_min'] = request_time[0]
-            to_netdata['resp_time_avg'] = float(request_counter['sum']) / request_counter['count']
+            to_netdata['resp_time_avg'] = round(float(request_counter['sum']) / request_counter['count'])
             to_netdata['resp_time_max'] = request_time[-1]
 
         to_netdata.update(self.storage)