azure-iot-sdk-python icon indicating copy to clipboard operation
azure-iot-sdk-python copied to clipboard

Feedback requested: Python SDK config and status object for debugging

Open BertKleewein opened this issue 1 year ago • 0 comments

Looking for feedback on mqtt_transport.py changes. Tony and I have been talking about something like this as a way for customers to get a quick status on the health of our library. This is far from complete, but the intention is to provide data for observability/debugging only with the hope of avoiding the need to pour through reams of debug data.

The config object looks like this;

  "paho_config": {
    "transport": "websockets",
    "protocol": "4",
    "keepalive": 60,
    "connect_timeout": 5.0,
    "reconnect_on_failure": true,
    "reconnect_delay_min": 7200,
    "reconnect_delay_max": 120,
    "host": "bertk.azure-devices.net",
    "port": 443,
    "proxy_args": {},
    "socket_class": "WebsocketWrapper",
    "socket_name": "No socket name"
  },

and the status object looks like this:

  "paho_status": {
    "connect_rc_codes": {
      "0": 2
    },
    "on_connect_rc_codes": {
      "0": 2
    },
    "connect_exceptions": {
      "timeout": 3
    },
    "disconnect_rc_codes": {},
    "on_disconnect_rc_codes": {
      "16": 1,
      "0": 1
    },
    "disconnect_exceptions": {},
    "publish_rc_codes": {
      "0": 631
    },
    "publish_exceptions": {},
    "subscribe_rc_codes": {},
    "subscribe_exceptions": {},
    "unsubscribe_rc_codes": {},
    "unsubscribe_exceptions": {},
    "count_message_received": 0,
    "count_subscribe": 0,
    "count_suback": 0,
    "count_unsubscribe": 0,
    "count_unsuback": 0,
    "count_publish": 631,
    "count_puback": 631,
    "shut_down": false,
    "time_since_last_paho_traffic_in": "0:00:00.779999",
    "time_since_last_paho_traffic_out": "0:00:05.885535",
    "client_object_id": 140285330079296,
    "thread_name": "Thread-14",
    "thread_is_alive": "True",
    "len_out_mesage_queue": 0,
    "len_in_message_queue": 0,
    "len_out_pakcet_queue": 0,
    "thread_terminate": false,
    "paho_connection_state": 1
  },

BertKleewein avatar Nov 23 '22 19:11 BertKleewein