-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Statsdreceiver optimizations #33683
Merged
Merged
Statsdreceiver optimizations #33683
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
hardproblems
force-pushed
the
statsd-optimize
branch
5 times, most recently
from
June 21, 2024 04:57
c9d26d1
to
6f02d29
Compare
jmacd
approved these changes
Jun 21, 2024
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.
Nice work.
hardproblems
force-pushed
the
statsd-optimize
branch
from
June 21, 2024 17:41
6f02d29
to
948853f
Compare
dmitryax
approved these changes
Jun 22, 2024
martin-majlis-s1
pushed a commit
to scalyr/opentelemetry-collector-contrib
that referenced
this pull request
Jun 24, 2024
**Description:** Optimize statsdreceiver code to reduce heap usage Also reduce failCnt increment to reduce memory footprint in cases of tons of malformed statsd messages **Link to tracking Issue:** <Issue number if applicable> **Testing:** - Tested internally and saw a 17% reduction in object allocation from our workloads (with ~2.5k/s statsd metrics input) mostly from reduction of strings.Split Screenshot is from `go tool pprof -http:8081 -diff_base baseline.heap.gz optimized.heap.gz` ![Screenshot 2024-06-20 at 12 45 17 PM](https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/142453/e8065097-2533-4934-9b78-c0e828e075ac) Note: I also saw lots of allocations from attribute.NewSet but idk the best way to go about reducing that. (Screenshot below is from unoptimized statsdreceiver) ![Screenshot 2024-06-20 at 12 44 32 PM](https://github.com/open-telemetry/opentelemetry-collector-contrib/assets/142453/293553c0-92c8-465b-872a-ddb7b68299a0) I tried changing statsDMetricDescription's attrs field to `map[string]any` in the hopes of using attributes.FromRaw in buildGaugeMetric but it would require replacing statsDMetricDescription as the type of the map key in instruments.gauges, etc.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
Optimize statsdreceiver code to reduce heap usage
Also reduce failCnt increment to reduce memory footprint in cases of tons of malformed statsd messages
Link to tracking Issue:
Testing:
Screenshot is from
go tool pprof -http:8081 -diff_base baseline.heap.gz optimized.heap.gz
Note: I also saw lots of allocations from attribute.NewSet but idk the best way to go about reducing that. (Screenshot below is from unoptimized statsdreceiver)
I tried changing statsDMetricDescription's attrs field to
map[string]any
in the hopes of using attributes.FromRaw in buildGaugeMetric but it would require replacing statsDMetricDescription as the type of the map key in instruments.gauges, etc.Documentation:
@jmacd @dmitryax