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

[xpack][metricbeats][gcp] don't skip first value in histogram calculations #41822

Merged
merged 14 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix Kubernetes metadata sometimes not being present after startup {pull}41216[41216]
- Do not report non-existant 0 values for RSS metrics in docker/memory {pull}41449[41449]
- Log Cisco Meraki `getDevicePerformanceScores` errors without stopping metrics collection. {pull}41622[41622]
- Don't skip first bucket value in GCP metrics metricset for distribution type metrics {pull}41822[41822]


*Osquerybeat*
Expand Down
4 changes: 2 additions & 2 deletions x-pack/metricbeat/module/gcp/distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ func DistributionHistogramToES(d *distribution.Distribution) mapstr.M {
bucket := d.BucketOptions.GetExponentialBuckets()

for i := range d.BucketCounts {
values = append(values, calcExponentialUpperBound(bucket, i+1))
values = append(values, calcExponentialUpperBound(bucket, i))
}
case d.BucketOptions.GetLinearBuckets() != nil:
bucket := d.BucketOptions.GetLinearBuckets()

for i := range d.BucketCounts {
values = append(values, calcLinearUpperBound(bucket, i+1))
values = append(values, calcLinearUpperBound(bucket, i))
}
}

Expand Down
4 changes: 2 additions & 2 deletions x-pack/metricbeat/module/gcp/distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestDistributionHistogramToES(t *testing.T) {
},
expected: mapstr.M{
"counts": []uint64{0, 0, 3, 1},
"values": []float64{6, 12, 24, 48},
"values": []float64{3, 6, 12, 24},
},
},
},
Expand All @@ -87,7 +87,7 @@ func TestDistributionHistogramToES(t *testing.T) {
},
expected: mapstr.M{
"counts": []uint64{0, 1, 2, 0},
"values": []float64{20, 35, 50, 65},
"values": []float64{5, 20, 35, 50},
},
},
},
Expand Down
Loading