Skip to content

Implement sum of squared deviations for exponential histograms #947

Open
@dashpole

Description

@dashpole

Similar to the implementation for histograms, we should create a sum of squared deviations for exponential histograms:

if m.cfg.MetricConfig.EnableSumOfSquaredDeviation {
// Calculate the sum of squared deviation.
for i := 0; i < bounds.Len(); i++ {
// Assume all points in the bucket occur at the middle of the bucket range
middleOfBucket := (prevBound + bounds.At(i)) / 2
deviation += float64(counts[i]) * (middleOfBucket - mean) * (middleOfBucket - mean)
prevBound = bounds.At(i)
}
// The infinity bucket is an implicit +Inf bound after the list of explicit bounds.
// Assume points in the infinity bucket are at the top of the previous bucket
middleOfInfBucket := prevBound
deviation += float64(counts[len(counts)-1]) * (middleOfInfBucket - mean) * (middleOfInfBucket - mean)
}

It should be implemented here:

func (m *metricMapper) exponentialHistogramPoint(point pmetric.ExponentialHistogramDataPoint, projectID string) *monitoringpb.TypedValue {

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions