Merge pull request #4 from tcivie/bug/crash-on-parsing-from-stat

Fixed issue when exporter tried to parse messages from the stat folder
This commit is contained in:
Gleb Tcivie 2024-06-27 23:54:52 +03:00 committed by GitHub
commit f2d02be6d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,12 @@ def handle_connect(client, userdata, flags, reason_code, properties):
def handle_message(client, userdata, message):
current_timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print(f"Received message on topic '{message.topic}' at {current_timestamp}")
# Filter out messages from the 'stat' topic
if '/stat/' in message.topic:
print(f"Filtered out message from topic containing '/stat/': {message.topic}")
return
envelope = ServiceEnvelope()
envelope.ParseFromString(message.payload)