From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:41:02 +0000 (-0500) Subject: Convert metrics_table.py to a module X-Git-Tag: rec-5.4.0-alpha1~93^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16479%2Fhead;p=thirdparty%2Fpdns.git Convert metrics_table.py to a module Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- diff --git a/pdns/recursordist/metrics.py b/pdns/recursordist/metrics.py index 3d11b68973..63d004eccd 100644 --- a/pdns/recursordist/metrics.py +++ b/pdns/recursordist/metrics.py @@ -1,6 +1,7 @@ import os import sys import shutil +import metrics_table # default: 'type': uint64 # ptype: "'counter' (vs gauge') @@ -31,9 +32,7 @@ def dedashForSNMP(name): ret = ret.replace('Nsec', 'NSEC') return ret -# read table -with open(srcdir + '/metrics_table.py', mode='r', encoding="utf-8") as file: - table = eval(file.read()) +table = metrics_table.table # # We create various files in the srcdir but copy them into the builddir if needed to satisfy meson diff --git a/pdns/recursordist/metrics_table.py b/pdns/recursordist/metrics_table.py index 2a4da2299c..8370ce2db1 100644 --- a/pdns/recursordist/metrics_table.py +++ b/pdns/recursordist/metrics_table.py @@ -24,7 +24,7 @@ # } # -[ +table = [ { 'name': 'questions', 'lambda': '[] { return g_Counters.sum(rec::Counter::qcounter); }',