diff options
| author | chenzizhan <[email protected]> | 2024-08-13 11:33:51 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2024-08-13 11:33:51 +0800 |
| commit | 644fd0a135b1f6d2bb572c8fc335eab7b2eb548c (patch) | |
| tree | c8b07cb04f1ae819e9fbd487dc3d27e8833e53da | |
| parent | d111832bb4da1dd7c50734810ffa428d44364254 (diff) | |
fix civ4.6.4
| -rw-r--r-- | src/exporter/fieldstat_exporter.py | 4 | ||||
| -rw-r--r-- | test/test_fieldstat_exporter.py | 2 |
2 files changed, 1 insertions, 5 deletions
diff --git a/src/exporter/fieldstat_exporter.py b/src/exporter/fieldstat_exporter.py index d3900ca..5816a8b 100644 --- a/src/exporter/fieldstat_exporter.py +++ b/src/exporter/fieldstat_exporter.py @@ -127,10 +127,6 @@ class PrometheusExporter: for key,value in src_tags.items(): dst_key = re.sub(r'[^a-zA-Z0-9_:]', '_', key) - for i in range(len(dst_key) - 1, -1, -1): - if dst_key[i] != '_': - break - dst_key = dst_key[:i] dst_val = str(value) dst_tags.append(f'{dst_key}="{dst_val}"') diff --git a/test/test_fieldstat_exporter.py b/test/test_fieldstat_exporter.py index 4f82f1a..537aab8 100644 --- a/test/test_fieldstat_exporter.py +++ b/test/test_fieldstat_exporter.py @@ -48,7 +48,7 @@ class TestPrometheusExporter(unittest.TestCase): def test__escape_metric_name(self): name = "tsg_master_log:(){}/\\%*$-,;" ret = self.prom._PrometheusExporter__escape_metric_name(name) - self.assertEqual(ret, "tsg_master_log:____________") + self.assertEqual(ret, "tsg_master_log:") def test__escape_metric_tags(self): json_obj = {'name': '-', |
