Skip to content

Commit

Permalink
Fix Histogram bucket counter metric sizing (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
mway authored May 11, 2021
1 parent b7bc80a commit e322209
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions m3/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ func (r *reporter) AllocateHistogram(
durationUpperBound: pair.UpperBoundDuration(),
metric: counter,
}
delta = len(r.bucketIDTagName) + len(r.bucketTagName) + len(idTagValue)
)

hbucket.metric.metric.Tags = append(
Expand All @@ -371,14 +372,16 @@ func (r *reporter) AllocateHistogram(

bucketIdx := len(hbucket.metric.metric.Tags) - 1
if isDuration {
hbucket.metric.metric.Tags[bucketIdx].Value =
r.durationBucketString(pair.LowerBoundDuration()) +
"-" + r.durationBucketString(pair.UpperBoundDuration())
bname := r.durationBucketString(pair.LowerBoundDuration()) + "-" +
r.durationBucketString(pair.UpperBoundDuration())
hbucket.metric.metric.Tags[bucketIdx].Value = bname
hbucket.metric.size += int32(delta + len(bname))
cachedDurationBuckets = append(cachedDurationBuckets, hbucket)
} else {
hbucket.metric.metric.Tags[bucketIdx].Value =
r.valueBucketString(pair.LowerBoundValue()) +
"-" + r.valueBucketString(pair.UpperBoundValue())
bname := r.valueBucketString(pair.LowerBoundValue()) + "-" +
r.valueBucketString(pair.UpperBoundValue())
hbucket.metric.metric.Tags[bucketIdx].Value = bname
hbucket.metric.size += int32(delta + len(bname))
cachedValueBuckets = append(cachedValueBuckets, hbucket)
}
}
Expand Down

0 comments on commit e322209

Please sign in to comment.