Skip to content

Conversation

@AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Nov 17, 2025

Summary

in influxdb_v2 output with concurrent_writes > 1 part of data may be dropped
here algorithm calculates a size of buffer dividing amount of metrics by workers count and increments by one if remainder is > 0, but this is not taken into account during calculation of batches count inside createBatches.

In current implementation with metrics slice of size 100k and concurrent_writes set to13 telegraf drops 7684 items
(100000 // ⌈100000/13⌉) * ⌈100000/13⌉= (100000//7693) * 7693 = 12 * 7693 = 92316

Checklist

@AndrewChubatiuk AndrewChubatiuk changed the title output/influxdb_v2: data may be dropped with write_concurrency > 1 fix(outputs/influxdb_v2): data may be dropped with write_concurrency > 1 Nov 17, 2025
@telegraf-tiger telegraf-tiger bot added the fix pr to fix corresponding bug label Nov 17, 2025
@AndrewChubatiuk AndrewChubatiuk changed the title fix(outputs/influxdb_v2): data may be dropped with write_concurrency > 1 fix(outputs/influxdb_v2): data may be dropped with concurrent_writes > 1 Nov 17, 2025
@AndrewChubatiuk AndrewChubatiuk force-pushed the influx-v2-write-concurrency-drops-metrics branch 2 times, most recently from 67e750f to 1f81ae2 Compare November 18, 2025 06:46
@AndrewChubatiuk AndrewChubatiuk changed the title fix(outputs/influxdb_v2): data may be dropped with concurrent_writes > 1 fix(outputs.influxdb_v2): data may be dropped with concurrent_writes > 1 Nov 18, 2025
@telegraf-tiger telegraf-tiger bot added area/influxdb plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Nov 18, 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 catching this @AndrewChubatiuk! Only one request to move your testing into an own test-function to not distort the benchmarks!

@srebhan srebhan changed the title fix(outputs.influxdb_v2): data may be dropped with concurrent_writes > 1 fix(outputs.influxdb_v2): Correct calculation of amount of batches for concurrent writes Nov 18, 2025
@srebhan srebhan self-assigned this Nov 18, 2025
@AndrewChubatiuk AndrewChubatiuk force-pushed the influx-v2-write-concurrency-drops-metrics branch from 1f81ae2 to 31eea20 Compare November 18, 2025 13:16
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 a lot @AndrewChubatiuk!

@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 Nov 20, 2025
@srebhan srebhan assigned skartikey and mstrandboge and unassigned srebhan Nov 20, 2025
Copy link
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@AndrewChubatiuk Thanks! A couple of minor comments.

@AndrewChubatiuk AndrewChubatiuk force-pushed the influx-v2-write-concurrency-drops-metrics branch from 31eea20 to a912da5 Compare November 20, 2025 13:06
@AndrewChubatiuk
Copy link
Contributor Author

@skartikey thanks for review
addressed your comments

@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 increases the Telegraf binary size by 1.34 % for linux amd64 (new size: 300.0 MB, nightly size 296.0 MB)

📦 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

Copy link
Contributor

@skartikey skartikey left a comment

Choose a reason for hiding this comment

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

@AndrewChubatiuk Thanks for the contribution!

@skartikey skartikey merged commit f415d77 into influxdata:master Nov 20, 2025
27 checks passed
@github-actions github-actions bot added this to the v1.37.0 milestone Nov 20, 2025
@AndrewChubatiuk AndrewChubatiuk deleted the influx-v2-write-concurrency-drops-metrics branch November 20, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/influxdb fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out 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.

4 participants