Skip to content

Commit 6c6bf79

Browse files
committed
improve json_label error handling
Signed-off-by: Zen <[email protected]>
1 parent 902ecba commit 6c6bf79

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "json_exporter"
7-
version = "0.13.3"
7+
version = "0.13.4"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]

src/json_exporter/json_endpoint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ async def update_json_labels(self):
3030
try:
3131
self.json_labels = JSONLabels(**kwargs)
3232
except MissingJSONKey as e:
33+
original_labels = self.json_label_paths.copy()
3334
self.logger.error("[%s] Failed to find JSON path: %s, removing" % (self.name, e))
34-
self.json_label_paths.pop(e.key)
35+
removed_key = self.json_label_paths.pop(e.key)
36+
self.logger.warning("[%s] Removed JSON path: %s" % (self.name, removed_key))
3537
await self.update_json_labels()
38+
self.logger.info("[%s] Resetting JSON labels to: %s" % (self.name, original_labels))
39+
self.json_label_paths = original_labels
3640

3741
def read_config(self):
3842
""" Reads the config file using the parent method, adds json specific config """

0 commit comments

Comments
 (0)