Skip to content

Commit

Permalink
fix: Don't warn on tag values we known we should ignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjw committed Nov 8, 2022
1 parent 7f70e1a commit b6f7c77
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prom433/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@

TAG_KEYS = {"id", "channel", "model"}

IGNORE_TAGS = {
"*": {"mic", "mod"},
"Fineoffset-WHx080": {"subtype"}
}

METRIC_NAME = {
"battery_ok": "prom433_battery_ok",
"temperature_C": "prom433_temperature",
Expand Down Expand Up @@ -130,6 +135,9 @@ def prometheus(message):
METRICS[metric] = {}
METRICS[metric][tag_value] = payload[key]

unknown = {key: value for (key, value) in unknown.items() if key not in
(IGNORE_TAGS["*"] | IGNORE_TAGS.get(tags["model"], set()))}

if len(unknown) > 0:
logging.warn(f"Message has unknown tags ({unknown}): {message}")

Expand Down

0 comments on commit b6f7c77

Please sign in to comment.