influxdata/telegraf

MQTT Consumer: Support Reading User-Properties

Open

#11,258 opened on Jun 6, 2022

View on GitHub
 (10 comments) (0 reactions) (0 assignees)Go (4,161 forks)batch import
area/mqttfeature requesthelp wantedsize/m

Repository metrics

Stars
 (9,892 stars)
PR merge metrics
 (Avg merge 2d 12h) (136 merged PRs in 30d)

Description

Feature Request

Opening a feature request kicks off a discussion.

Proposal:

If the internet connection dies, our device will remember the unsent messages, and when the internet connection comes back send all of them.

Since Telegraf is adding the timestamp, all of those messages would get wrong timestamps once they reach the server.

Instead, we want to use a user-property “time”, which is the time when we measured our actual sensor. Once they reach Telegraf, we want Telegraf to use that timestamp for the InfluxDB insert.

Current behaviour:

Telegraf does not support reading data from user-properties within a MQTT payload.

Desired behavior:

Provide the ability to parse user-property data. Similar to how we parse topics.

Use case:

we want to use a user-property “time”, which is the time when we measured our actual sensor. Once they reach Telegraf, we want Telegraf to use that timestamp for the InfluxDB insert.

The alternative is to use json_v2/timestamp_key. It seems Telegraf is using paho.mqtt.golang, there is this fork which supports mqtt 5, but it seems to be a bit different GitHub - eclipse/paho.golang: Go libraries, for example there is no ClientOptions. Therefore it is not a drop-in replacement.

Community link: https://community.influxdata.com/t/handling-mqtt-5-properties-in-telegraf/25255/2

Contributor guide