diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:22:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:22:44 +0000 |
commit | 1e6c93250172946eeb38e94a92a1fd12c9d3011e (patch) | |
tree | 8ca5e16dfc7ad6b3bf2738ca0a48408a950f8f7e /collectors/python.d.plugin/traefik/traefik.chart.py | |
parent | Update watch file (diff) | |
download | netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.tar.xz netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.zip |
Merging upstream version 1.11.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/traefik/traefik.chart.py (renamed from python.d/traefik.chart.py) | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/python.d/traefik.chart.py b/collectors/python.d.plugin/traefik/traefik.chart.py index f7c3e223b..dc8933220 100644 --- a/python.d/traefik.chart.py +++ b/collectors/python.d.plugin/traefik/traefik.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: traefik netdata python.d module # Author: Alexandre Menezes (@ale_menezes) +# SPDX-License-Identifier: GPL-3.0-or-later from json import loads from collections import defaultdict @@ -32,7 +33,8 @@ CHARTS = { ['redirects', 'redirect', 'incremental'], ['bad_requests', 'bad', 'incremental'], ['other_requests', 'other', 'incremental'] - ]}, + ] + }, 'response_codes': { 'options': [None, 'Responses by codes', 'requests/s', 'responses', 'traefik.response_codes', 'stacked'], 'lines': [ @@ -42,37 +44,45 @@ CHARTS = { ['4xx', None, 'incremental'], ['1xx', None, 'incremental'], ['other', None, 'incremental'] - ]}, + ] + }, 'detailed_response_codes': { - 'options': [None, 'Detailed response codes', 'requests/s', 'responses', 'traefik.detailed_response_codes', 'stacked'], - 'lines': [ - ]}, + 'options': [None, 'Detailed response codes', 'requests/s', 'responses', 'traefik.detailed_response_codes', + 'stacked'], + 'lines': [] + }, 'requests': { 'options': [None, 'Requests', 'requests/s', 'requests', 'traefik.requests', 'line'], 'lines': [ ['total_count', 'requests', 'incremental'] - ]}, + ] + }, 'total_response_time': { 'options': [None, 'Total response time', 'seconds', 'timings', 'traefik.total_response_time', 'line'], 'lines': [ ['total_response_time_sec', 'response', 'absolute', 1, 10000] - ]}, + ] + }, 'average_response_time': { 'options': [None, 'Average response time', 'milliseconds', 'timings', 'traefik.average_response_time', 'line'], 'lines': [ ['average_response_time_sec', 'response', 'absolute', 1, 1000] - ]}, + ] + }, 'average_response_time_per_iteration': { - 'options': [None, 'Average response time per iteration', 'milliseconds', 'timings', 'traefik.average_response_time_per_iteration', 'line'], + 'options': [None, 'Average response time per iteration', 'milliseconds', 'timings', + 'traefik.average_response_time_per_iteration', 'line'], 'lines': [ ['average_response_time_per_iteration_sec', 'response', 'incremental', 1, 10000] - ]}, + ] + }, 'uptime': { 'options': [None, 'Uptime', 'seconds', 'uptime', 'traefik.uptime', 'line'], 'lines': [ ['uptime_sec', 'uptime', 'absolute'] - ]} + ] } +} HEALTH_STATS = [ 'uptime_sec', @@ -82,6 +92,7 @@ HEALTH_STATS = [ 'total_status_code_count' ] + class Service(UrlService): def __init__(self, configuration=None, name=None): UrlService.__init__(self, configuration=configuration, name=name) @@ -116,9 +127,11 @@ class Service(UrlService): self.data['average_response_time_sec'] *= 1000000 self.data['total_response_time_sec'] *= 10000 if data['total_count'] != self.last_total_count: - self.data['average_response_time_per_iteration_sec'] = (data['total_response_time_sec'] - self.last_total_response_time) * 1000000 / (data['total_count'] - self.last_total_count) + self.data['average_response_time_per_iteration_sec'] = \ + (data['total_response_time_sec'] - self.last_total_response_time) * \ + 1000000 / (data['total_count'] - self.last_total_count) else: - self.data['average_response_time_per_iteration_sec'] = 0 + self.data['average_response_time_per_iteration_sec'] = 0 self.last_total_response_time = data['total_response_time_sec'] self.last_total_count = data['total_count'] @@ -165,6 +178,7 @@ class Service(UrlService): self.charts['detailed_response_codes'].add_dimension([code, code, 'incremental']) self.data[code] = value + def fetch_data_(raw_data, metrics): data = dict() |