Skip to content
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

[prometheusremotewriteexporter] reduce allocations when serializing protobufs #35185

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

edma2
Copy link
Contributor

@edma2 edma2 commented Sep 14, 2024

Description:

There are two allocations that happen on every push

  1. Serializing the remote write protobuf to a byte array.
  2. Compressing the byte array with snappy.

Since these buffers can be quite large, we can save some allocations with a sync.Pool.

Link to tracking Issue:

Testing:

Tests still pass. We have been running this successfully in production for a few months now.

Documentation:

@dashpole
Copy link
Contributor

Looks great! Are you able to add a benchmark to demonstrate the improvement and make sure it doesn't regress in the future?

cc @jmichalek132 @ArthurSens feel free to review as well

Copy link
Contributor

@jmichalek132 jmichalek132 left a comment

Choose a reason for hiding this comment

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

LGTM, but could you please look at the failing compliance tests? So turns out that should be fixed now #35119 so rebasing should hopefully make them pass.

By any chance is there any visible improvement you can see with this change from the metrics of the collector, if so could you post them here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants