feat: log incoming and outgoing packets in built-in bridge#3770
feat: log incoming and outgoing packets in built-in bridge#3770jarhodes314 merged 1 commit intothin-edge:mainfrom
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
Robot Results
|
didier-wenzek
left a comment
There was a problem hiding this comment.
I will be happy to see this PR merged. I just wonder if this wouldn't be better to make consistent all the bridge-related log entries.
Currently we have:
2025-08-27T08:02:07.863413221Z INFO tedge_mqtt_bridge: Bridge cloud connection still waiting ack for pkid=34
2025-08-27T08:02:07.886647957Z INFO MQTT bridge: [cloud] Received SUBACK (Subscription Acknowledged): SubAck { pkid: 101, return_codes: [Success(AtLeastOnce)] }
The following would be more consistent:
2025-08-27T08:02:07.863413221Z INFO MQTT bridge: [cloud] Bridge cloud connection still waiting ack for pkid=34
2025-08-27T08:02:07.886647957Z INFO MQTT bridge: [cloud] Received SUBACK (Subscription Acknowledged): SubAck { pkid: 101, return_codes: [Success(AtLeastOnce)] }
| Ok(Event::Incoming(Packet::PingReq)) => { | ||
| log_event!(self, "Received PINGREQ (Ping Request)"); | ||
| } | ||
| Ok(Event::Incoming(Packet::PingResp)) => { | ||
| log_event!(self, "Received PINGRESP (Ping Response)"); | ||
| } | ||
| Ok(Event::Outgoing(Outgoing::PingReq)) => { | ||
| log_event!(self, "Sent PINGREQ (Ping Request)"); | ||
| } | ||
| Ok(Event::Outgoing(Outgoing::PingResp)) => { | ||
| log_event!(self, "Sent PINGRESP (Ping Response)"); | ||
| } |
There was a problem hiding this comment.
Isn't this a bit too verbose?
I would log PING event with a debug level.
There was a problem hiding this comment.
Now done. If the bridge is in use, I wouldn't expect pings to be too frequent, as they're only sent in the case of no other MQTT messages being sent or received, but this is also unlikely to be very frequently useful (unanswered pings are useful to know about, but those will be logged as errors anyway).
0fd8237 to
14e38e8
Compare
14e38e8 to
654b6d4
Compare
654b6d4 to
38ac74b
Compare
Proposed changes
Adds logging for the packets sent and received by the built-in bridge. It logs connection, subscription and ping related packets. It doesn't log publish or acknowledge packets as this would be very noisy.
Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments