thingsboard / thingsboard/thingsboard-python-client-sdk
Telemetry upload bug if telemetry list is not ordered by timestamp or if elements of list have different number of key/value pairs
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 130
- フォーク
- 86
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I'm using tb-mqtt-client version 1.10.10
I have a use-case where I'm uploading a list of telemetry readings. Depending on the order of the list, sometimes not all telemetry is being uploaded and sometimes the timestamp with which it is being uploaded is incorrect...
I first though that the list needed to be sorted by the timestamp attribute but then I had cases where even if it was sorted by timestamp it would work fine. It seems to be a combination of the list not being sorted with each element of the list not having the same number of key/value pairs.
I can't figure out or understand this behavior so any help would be appreciated.
This is the code snippet I'm using for testing this problem:
from tb_device_mqtt import TBPublishInfo
from tb_gateway_mqtt import TBGatewayMqttClient
telemetry =[...]
client = TBGatewayMqttClient("my.url.com", port=1883, username="token")
client.connect()
result = client.gw_send_telemetry('test device', telemetry)
success = result.get() == TBPublishInfo.TB_ERR_SUCCESS
client.disconnect()
print(success)
Following are some examples of the problem where the only thing I'm changing is the order of the telemetry list:
Example 1 - works fine
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1,
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3,
'test_3_1': 3,
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
]
Example 2 - does not upload test_2 and test_2_1 telemetry
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3
}
},
]
Example 3 - test_1 and test_1_1 are being uploaded with the wrong timestamp. They are being uploaded with the same timestamp as test_3
telemetry =[
{
'ts': 1736330010000,
'values': {
'test_1': 1,
'test_1_1': 1,
}
},
{
'ts': 1736330030000,
'values': {
'test_3': 3,
}
},
{
'ts': 1736330020000,
'values': {
'test_2': 2,
'test_2_1': 2
}
},
]
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、TBGatewayMqttClient.gw_send_telemetry を通じて 3 つのテレメトリ例を再現し、アップロードされた結果を比較します。テレメトリのアップロードパスを追跡して、リストの順序と値の長さの違いがタイムスタンプとエントリにどのような影響を与えるかを特定します。入力の順序や形状にかかわらず、すべての値が対応するタイムスタンプとともにアップロードされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100