Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sum of squared deviations for exponential histograms #947

Open
dashpole opened this issue Dec 3, 2024 · 0 comments
Open

Implement sum of squared deviations for exponential histograms #947

dashpole opened this issue Dec 3, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request priority: p2

Comments

@dashpole
Copy link
Contributor

dashpole commented Dec 3, 2024

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 {

@dashpole dashpole added enhancement New feature or request priority: p2 labels Dec 3, 2024
@dashpole dashpole self-assigned this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: p2
Projects
None yet
Development

No branches or pull requests

1 participant