You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Messages are timestamped properly and all received. The elapsed time between values is very erratic.
Actual behavior
Messages are sometimes timestamped late or missed
Additional info
After implementing #15883 in our custom build of Telegraf we still see that points are not being logged at a consistent 50Hz. Some points are late or are missed.
I experimented with calling the onData function in the inputs.socket_listener with go onData. This significantly improves the accuracy of the timestamping, because we no longer wait to read the buffer again while we are still parsing the previous message. I also had to add a feature that overrides the timestamp from the parser with the time recorded when the UDP packet is read from the buffer.
Elapsed time since last data point
Adding this greatly improves the accuracy and consistency of the timestamping. The way I implemented it is very hacky though and a better implementation is needed.
Possible solution
I would propose to add an interface ParserWithTimestamp or something like that. These kinds of parsers accept a timestamp from the input plugin they are used by and implement:
With this it is possible for parsers to give an option to the user to use the "input time" as the time source, or to use the other options the parser offers. My guess is that not many input plugins will actually use the "input time", except inputs.socket_listener.
The text was updated successfully, but these errors were encountered:
Relevant telegraf.conf
Not relevant
Logs from Telegraf
System info
Telegraf 1.31.2, Ubuntu 24.02
Docker
No response
Steps to reproduce
...
Expected behavior
Messages are timestamped properly and all received. The elapsed time between values is very erratic.
Actual behavior
Messages are sometimes timestamped late or missed
Additional info
After implementing #15883 in our custom build of Telegraf we still see that points are not being logged at a consistent 50Hz. Some points are late or are missed.
I experimented with calling the
onData
function in theinputs.socket_listener
withgo onData
. This significantly improves the accuracy of the timestamping, because we no longer wait to read the buffer again while we are still parsing the previous message. I also had to add a feature that overrides the timestamp from the parser with the time recorded when the UDP packet is read from the buffer.Elapsed time since last data point
Adding this greatly improves the accuracy and consistency of the timestamping. The way I implemented it is very hacky though and a better implementation is needed.
Possible solution
I would propose to add an interface
ParserWithTimestamp
or something like that. These kinds of parsers accept a timestamp from the input plugin they are used by and implement:ParseWithTimestamp([]byte, time.Time) []telegraf.Metric
ParseLineWithTimestamp([]byte, time.Time) []telegraf.Metric
With this it is possible for parsers to give an option to the user to use the "input time" as the time source, or to use the other options the parser offers. My guess is that not many input plugins will actually use the "input time", except
inputs.socket_listener
.The text was updated successfully, but these errors were encountered: