Conversation
Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
…nd add a benchmark for NewDesc Signed-off-by: Kyle Eckhart <kgeckhart@users.noreply.github.com>
Signed-off-by: bwplotka <bwplotka@gmail.com>
bwplotka
commented
Feb 20, 2025
| @@ -215,25 +214,22 @@ func populateMetric( | |||
| // This function is only needed for custom Metric implementations. See MetricVec | |||
| // example. | |||
| func MakeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair { | |||
Member
Author
There was a problem hiding this comment.
I think there's an opportunity to move this to []fastdto.LabelPair and pay the price of allocs on Write 🤔 (on scrape)
|
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
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.
Experimenting with tailored dto for #1734
*dto.LabelPairs are pretty bad. We got stuck with *dto.Metric in our API since the beginning. This is problematic with the notorious use of small objects and pointers everywhere and all structs are bigger to support unknown fields and parsing. We don't need any of this in client_golang - it's just overhead for us. We only need interim struct and fast encoding.
This is also the reason why we can't optimize #1734 further.
We always wanted to do move out, but we can't change dto.Metric use due to compatibility....
...unless we can (:
We could start introducing it slowly and then do
Write2(m fastdto.Metric)or so API if we want (or release v2 client golang which I would love to avoid).Benchmarks are not ideal. I think it keeps the CPU adventage of #1734, but "reverts" the allocs to where they were.
I think for the next iteration we could try moving this cost to
Write(so when collect is used). When collecting one could pool/reuse dto.Metrics OR useWrite2with fastdto Metric 🤔