Extract HDR histogram implementation into a shared package #4611
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.
What?
It extracts the HDR histogram implementation from the
expv2
Cloud output package, into an internal but shared package, so it can be reused for ourmetrics.TrendSink
implementation and/or (at the very least) for theSummary
output.Why?
Because as discussed and suggested here it's likely the best way to move forward. Plus, now that we're about to release a new major, it's likely a good moment to add this kind of breaking change (behavioral, not programmatic API).
Related PR(s)/Issue(s)
Related with #763
Notes for the reviewer(s)
To facilitate the review, I'd suggest to do a clipboard diff between the contents that were on
expv2/hdr.go
vs the newhistogram/hdr.go
. But to summarize, it's mostly about making the type and constructor public, and leaving the protobuf specific bits in the Cloud output package, because it feels like it's specific to that.Also, note that I decided to create this
histogram
package inside ads
directory, standing for "data structures", but I'd be happy to either renameds
into something more explicit, and/or movehistogram
into a first level package insideinternal
. As it is internal, it should be fine to start this way and move into ads
package tomorrow if we ever add more data structures. Just tell me what you prefer.