Update model/histogram/float_histogram.go

Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
pull/12711/head
Ziqi Zhao 2023-08-24 07:17:23 +08:00 committed by GitHub
parent 893f97556f
commit d3633d4e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -923,9 +923,18 @@ func mergeToSchema(originSpans []Span, originBuckets []float64, originSchema, ta
return targetSpans, targetBuckets return targetSpans, targetBuckets
} }
// addBuckets add two groups of Spans by inspecting the // addBuckets adds the buckets described by spansB/bucketsB to the buckets described by spansA/bucketsA,
// spans in other and create missing buckets in origin in batches. // creating missing buckets in spansA/bucketsA as needed.
func addBuckets(schema int32, threshold float64, negative bool, spansA []Span, bucketsA []float64, spansB []Span, bucketsB []float64) ([]Span, []float64) { // It returns the resulting spans/buckets (which must be used instead of the original spansA/bucketsA,
// although spansA/bucketsA might get modified by this function).
// All buckets must use the same provided schema.
// Buckets in spansB/bucketsB with an absolute upper limit ≤ threshold are ignored.
// If negative is true, the buckets in spansB/bucketsB are subtracted rather than added.
func addBuckets(
schema int32, threshold float64, negative bool,
spansA []Span, bucketsA []float64,
spansB []Span, bucketsB []float64,
) ([]Span, []float64) {
var ( var (
iSpan int = -1 iSpan int = -1
iBucket int = -1 iBucket int = -1