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
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 130
- Fork
- 86
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
}
},
]
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện ba ví dụ telemetry thông qua TBGatewayMqttClient.gw_send_telemetry và so sánh các kết quả đã tải lên. Theo dõi đường dẫn tải lên telemetry để xác định thứ tự danh sách và độ dài khác nhau của các giá trị ảnh hưởng như thế nào đến timestamp và các mục nhập; được xem là hoàn tất khi mọi giá trị đều được tải lên cùng với timestamp tương ứng, bất kể thứ tự hoặc hình dạng của đầu vào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100