Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@skartikey
Copy link
Contributor

@skartikey skartikey commented Jul 30, 2025

Summary

Fixes counter wraparound issue in diskio plugin that was causing io_util, io_svctm, and io_await metrics to occasionally produce massive values in the trillions instead of expected decimal values.

Root cause: Lines calculating deltas like deltaIOTime := float64(io.IoTime - lastValue.IoTime) don't account for counter wraparound scenarios.

Example

Before (with bug)

diskio,name=sda reads=1234,writes=5678,read_bytes=987654,io_time=12345,io_util=2847391847382.3,io_await=9847382947.2,io_svctm=8472947.1 

After (during wraparound detection):

diskio,name=sda reads=1234,writes=5678,read_bytes=987654,io_time=12345,io_util=0.0,io_await=0.0,io_svctm=0.0
# Zero values provided instead of trillion-scale incorrect values

After (normal operation resumes):

diskio,name=sda reads=1234,writes=5678,read_bytes=987654,io_time=12345,io_util=15.2,io_await=2.3,io_svctm=1.1

Checklist

  • No AI generated code was used in this PR

Related issues

resolves #17408

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jul 30, 2025
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for approaching this @skartikey! A suggestion for a less invasive change...

@skartikey skartikey requested a review from srebhan August 21, 2025 20:40
@skartikey skartikey force-pushed the inputs_diskio_wraparound_bug branch from bb95589 to 9342a97 Compare August 29, 2025 19:51
@telegraf-tiger
Copy link
Contributor

Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip.
Downloads for additional architectures and packages are available below.

☺️ This pull request doesn't significantly change the Telegraf binary size (less than 1%)

📦 Click here to get additional PR build artifacts

Artifact URLs

. DEB . RPM . TAR . GZ . ZIP
[[amd64.deb aarch64.rpm darwin_amd64.tar.gz windows_amd64.zip] [arm64.deb armel.rpm darwin_arm64.tar.gz windows_arm64.zip] [armel.deb armv6hl.rpm freebsd_amd64.tar.gz windows_i386.zip] [armhf.deb i386.rpm freebsd_armv7.tar.gz ] [i386.deb ppc64le.rpm freebsd_i386.tar.gz ] [mips.deb riscv64.rpm linux_amd64.tar.gz ] [mipsel.deb s390x.rpm linux_arm64.tar.gz ] [ppc64el.deb x86_64.rpm linux_armel.tar.gz ] [riscv64.deb linux_armhf.tar.gz ] [s390x.deb linux_i386.tar.gz ] [ linux_mips.tar.gz ] [ linux_mipsel.tar.gz ] [ linux_ppc64le.tar.gz ] [ linux_riscv64.tar.gz ] [ linux_s390x.tar.gz ]]

@srebhan srebhan changed the title fix(inputs.diskio): Handle counter wraparound in io_* metrics calculation fix(inputs.diskio): Handle counter wrapping in io fields Sep 1, 2025
@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Sep 1, 2025
@srebhan srebhan removed their assignment Sep 1, 2025
@mstrandboge mstrandboge merged commit 295096e into influxdata:master Sep 2, 2025
29 checks passed
@github-actions github-actions bot added this to the v1.36.0 milestone Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diskio: new io_* metrics not checking for wraparound

3 participants