Skip to content

Commit 4b3928e

Browse files
committed
Fix floating point precision loss in nodes stats API
Change ConcurrentAVGSliceCount field from float32 to float64 in nodes stats API response to prevent precision loss. This fixes test failures where values like 1.6666666666666667 were being truncated to 1.6666666 due to float32 precision limits. Resolves OpenSearch 3.2.0+ compatibility issues with nodes stats API floating point values. Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 6949c2f commit 4b3928e

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1818
- Fix nodes stats API compatibility with OpenSearch 3.2.0+ by adding max_last_index_request_timestamp and startree query fields
1919
- Fix indices stats API compatibility with OpenSearch 3.2.0+ by adding max_last_index_request_timestamp and startree query fields
2020
- Fix cat APIs compatibility with OpenSearch 3.2.0+ by adding indexing timestamp and startree query fields
21+
- Fix floating point precision loss in nodes stats concurrent_avg_slice_count field by changing from float32 to float64
2122

2223
### Security
2324

opensearchapi/api_nodes-stats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ type NodesStatsIndices struct {
157157
ConcurrentQueryTotal int `json:"concurrent_query_total"`
158158
ConcurrentQueryTimeInMillis int `json:"concurrent_query_time_in_millis"`
159159
ConcurrentQueryCurrent int `json:"concurrent_query_current"`
160-
ConcurrentAVGSliceCount float32 `json:"concurrent_avg_slice_count"`
160+
ConcurrentAVGSliceCount float64 `json:"concurrent_avg_slice_count"`
161161
StartreeQueryTotal int `json:"startree_query_total"` // Available in OpenSearch 3.2.0+
162162
StartreeQueryTimeInMillis int `json:"startree_query_time_in_millis"` // Available in OpenSearch 3.2.0+
163163
StartreeQueryCurrent int `json:"startree_query_current"` // Available in OpenSearch 3.2.0+

0 commit comments

Comments
 (0)