Uninett / nav

Network Administration Visualized
GNU General Public License v3.0
194 stars 39 forks source link

Netbox context seems to be lost from ipdevpoll loggers under Python 3 #1875

Open lunkwill42 opened 5 years ago

lunkwill42 commented 5 years ago

When running under Python 3, it seems that ipdevpoll's ContextLogger instances are no longer able to fill their context with information about the Netbox currently being worked on, which means a lot of essential detail is lost from the logs.

yytsui commented 5 years ago

This was the exception ipdevpoll raised in Python3:

.... return g.throw(self.type, self.value, self.tb) File "/home/admin/pyenv/navp3/src/nav/python/nav/ipdevpoll/plugins/statsystem.py", line 127, in _collect_cpu load = yield self._get_cpu_loadavg(mib, netboxes) File "/home/admin/pyenv/navp3/lib/python3.6/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks result = g.send(result) File "/home/admin/pyenv/navp3/src/nav/python/nav/ipdevpoll/plugins/statsystem.py", line 149, in _get_cpu_loadavg interval) File "/home/admin/pyenv/navp3/src/nav/python/nav/metrics/templates.py", line 48, in metric_path_for_cpu_load cpu_name=escape_metric_name(cpu_name), File "/home/admin/pyenv/navp3/src/nav/python/nav/metrics/names.py", line 35, in escape_metricname string = string.replace(char, "") builtins.TypeError: a bytes-like object is required, not 'str'

It did not happen in Python2 though.

lunkwill42 commented 5 years ago

This was the exception ipdevpoll raised in Python3:

Well, actually, @yytsui , this is a different issue altogether, you should post a new one.