Mercurial > code > home > repos > mqtt_metrics
comparison mqtt_metrics.py @ 8:82cec89e6534
fix: the point was to notice when multiple patterns matched
author | drewp@bigasterisk.com |
---|---|
date | Sun, 11 Aug 2024 18:28:53 -0700 |
parents | a640efa9fb01 |
children | 789042521535 |
comparison
equal
deleted
inserted
replaced
7:a640efa9fb01 | 8:82cec89e6534 |
---|---|
109 if not matchedPats: | 109 if not matchedPats: |
110 try: | 110 try: |
111 metricEvents.extend(converter(message, cast(tuple[str], m.groups()))) | 111 metricEvents.extend(converter(message, cast(tuple[str], m.groups()))) |
112 except Exception: | 112 except Exception: |
113 log.error("Error converting mqtt message: topic pattern = %r", converter.topic_pattern, exc_info=True) | 113 log.error("Error converting mqtt message: topic pattern = %r", converter.topic_pattern, exc_info=True) |
114 matchedPats.append(converter.topic_pattern) | 114 matchedPats.append(converter.topic_pattern) |
115 | 115 |
116 if len(matchedPats) > 1: | 116 if len(matchedPats) > 1: |
117 log.warning("Multiple patterns matched: %s", ", ".join(matchedPats)) | 117 log.warning("Multiple patterns matched: %s", ", ".join(matchedPats)) |
118 | 118 |
119 return metricEvents | 119 return metricEvents |