Skip to content

Fix Zabbix agent sample timestamps dropping the sub-second part. - #14151

Merged
wu-sheng merged 3 commits into
apache:masterfrom
songzhendong:fix/zabbix-agent-sample-millis
Oct 20, 2026
Merged

wu-sheng merged 3 commits into
apache:masterfrom
songzhendong:fix/zabbix-agent-sample-millis

Conversation

@songzhendong

@songzhendong songzhendong commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Zabbix agent data carries clock (Unix seconds) and ns (nanoseconds within that second). The receiver parsed ns but stored each sample at clock * 1000, so the timestamp was always a whole second and the sub-second part was dropped.

The sample time is now clock * 1000 + ns / 1_000_000. Meter samples are milliseconds, so the remainder below 1 ms is dropped. ns of 999999, 1000000 and 999999999 land at +0 ms, +1 ms and +999 ms, and the last of those stays in the same second.

Test plan

  • ZabbixMetricsTimestampTest covers a sub-second ns, ns = 0, and the three millisecond boundaries above
  • Fork CI unit tests and the VM Zabbix end-to-end case

Agent data items carry clock in seconds and ns within that second. The sample time used only the seconds, so meter timestamps were always whole seconds.
@songzhendong

Copy link
Copy Markdown
Contributor Author

songzhendong#16 Fork is green

@wu-sheng

Copy link
Copy Markdown
Member

I will check this after #14152 merges. We have some works pending on that.

@songzhendong

Copy link
Copy Markdown
Contributor Author

Thanks ,Good luck!

Stored metrics are minute-bucketed and never held the whole-second
time, so the changelog line now says where the sub-second part can
show: values from custom Zabbix rules using MAL rate, irate or
increase. Results from the bundled rules and the minute a sample lands
in are unchanged.

Also drop the test comments that restated the assertions, and move
sampleTimeMillis below the instance fields with the other methods.
@wu-sheng wu-sheng added this to the 11.1.0 milestone Oct 19, 2026
@wu-sheng wu-sheng added bug Something isn't working and you are sure it's a bug! backend OAP backend related. labels Oct 19, 2026
@wu-sheng
wu-sheng merged commit 21f7798 into apache:master Oct 20, 2026
480 of 483 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend OAP backend related. bug Something isn't working and you are sure it's a bug!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants