From 6ab375197eb9e7e202d934b68285a9027f8ecaf9 Mon Sep 17 00:00:00 2001 From: kongfei605 Date: Sat, 24 Feb 2024 08:59:44 +0800 Subject: [PATCH] fix: use ntp servers time as timestamp of ntp offset (#807) --- inputs/ntp/ntp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inputs/ntp/ntp.go b/inputs/ntp/ntp.go index 95914c49..39db1d5f 100644 --- a/inputs/ntp/ntp.go +++ b/inputs/ntp/ntp.go @@ -64,7 +64,7 @@ func (n *NTPStat) Gather(slist *types.SampleList) { duration := ((serverReciveTime.UnixNano() - orgTime.UnixNano()) + (serverTransmitTime.UnixNano() - dstTime.UnixNano())) / 2 delta := duration / 1e6 // convert to ms - slist.PushSample("", "ntp_offset_ms", delta) + slist.PushFront(types.NewSample(inputName, "offset_ms", delta).SetTime(serverTransmitTime)) break } }