-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(inputs.win_perf_counter): Do not rely on returned buffer size #14241
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Nov 2, 2023
srebhan
force-pushed
the
win_perf_issue_14097
branch
from
November 3, 2023 14:18
a185636
to
da0df4f
Compare
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
powersj
approved these changes
Nov 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Hipska
added a commit
to Super-Visions/telegraf
that referenced
this pull request
Nov 7, 2023
* master: fix(inputs.win_perf_counter): Do not rely on returned buffer size (influxdata#14241) feat(inputs.modbus): Add support for string-fields (influxdata#14145) chore(deps): Bump cloud.google.com/go/storage from 1.30.1 to 1.34.1 (influxdata#14253) chore(deps): Bump github.com/rabbitmq/amqp091-go from 1.8.1 to 1.9.0 (influxdata#14252) chore(deps): Bump github.com/hashicorp/consul/api from 1.25.1 to 1.26.1 (influxdata#14251) chore(deps): Bump github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs from 1.23.5 to 1.26.0 (influxdata#14249) fix(config): Fix comment removal in TOML files (influxdata#14240) feat(outputs.prometheus_client): Support listen on vsock (influxdata#14108) fix(inputs.mqtt_consumer): Resolve could not mark message delivered (influxdata#14243) chore(linters): Fix findings found by testifylint for Windows and enable it. (influxdata#14238) feat(migrations): Add option migration for inputs.nats_consumer (influxdata#14234) feat(migrations): Add option migration for inputs.mqtt_consumer (influxdata#14233) test(inputs.jolokia2_agent): Sort metrics as order is not consistent (influxdata#14227)
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves #14097
might resolve #9809
In the current implementation we rely on the buffer-size returned by the Microsoft API in e.g.
GetCounterPath()
. However, as stated in the API documentation we should not rely on this returned value to allocate the buffer as the data might for example grow while querying.This PR fixes the instances that currently relies on the returned size by preallocate a buffer with a start size (currently 1KiB) and grow exponentially until the data fits or the maximum size is reached. The "maximum size" can be specified by a new
MaxBufferSize
config option (default 4MiB). As an optimization we short-cut some iterations by jumping to the size returned by the API in case it is bigger that the current buffer length...