Performance improvements for the metricstarttime processor#40998
Merged
Conversation
0a0396a to
c1671ea
Compare
Contributor
Author
0296360 to
d2e29e7
Compare
994a514 to
d653622
Compare
atoulme
approved these changes
Jul 13, 2025
Dylan-M
pushed a commit
to Dylan-M/opentelemetry-collector-contrib
that referenced
this pull request
Aug 5, 2025
…metry#40998) #### Description The existing implementation copied everything from the previous resourcemetrics to a completely new resourcemetrics. However, the component is marked as mutating data, so this PR just changes it to mutate the batch of metrics in-place. This avoids a lot of copying. From previous experience caching start times and values, storing attributes and exemplars in a cache is very expensive unless you need them. The second commit adds "minimal copy to" methods to avoid storing attributes and exemplars. #### Link to tracking issue Fixes open-telemetry#39400 #### Testing Passes all existing unit tests.
This file contains hidden or 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
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
The existing implementation copied everything from the previous resourcemetrics to a completely new resourcemetrics. However, the component is marked as mutating data, so this PR just changes it to mutate the batch of metrics in-place. This avoids a lot of copying.
From previous experience caching start times and values, storing attributes and exemplars in a cache is very expensive unless you need them. The second commit adds "minimal copy to" methods to avoid storing attributes and exemplars.
Link to tracking issue
Fixes #39400
Testing
Passes all existing unit tests.