diff --git a/mktxp/collector/base_collector.py b/mktxp/collector/base_collector.py index 8f84ea6..5e7db20 100644 --- a/mktxp/collector/base_collector.py +++ b/mktxp/collector/base_collector.py @@ -21,7 +21,9 @@ class BaseCollector: For use by custom collector ''' @staticmethod - def info_collector(name, decription, router_records, metric_labels=[]): + def info_collector(name, decription, router_records, metric_labels=None): + if metric_labels is None: + metric_labels = [] BaseCollector._add_id_labels(metric_labels) collector = InfoMetricFamily(f'mktxp_{name}', decription) @@ -31,7 +33,9 @@ class BaseCollector: return collector @staticmethod - def counter_collector(name, decription, router_records, metric_key, metric_labels=[]): + def counter_collector(name, decription, router_records, metric_key, metric_labels=None): + if metric_labels is None: + metric_labels = [] BaseCollector._add_id_labels(metric_labels) collector = CounterMetricFamily(f'mktxp_{name}', decription, labels=metric_labels) @@ -41,7 +45,9 @@ class BaseCollector: return collector @staticmethod - def gauge_collector(name, decription, router_records, metric_key, metric_labels=[], add_id_labels = True): + def gauge_collector(name, decription, router_records, metric_key, metric_labels=None, add_id_labels = True): + if metric_labels is None: + metric_labels = [] if add_id_labels: BaseCollector._add_id_labels(metric_labels) collector = GaugeMetricFamily(f'mktxp_{name}', decription, labels=metric_labels)